Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84436

QColor operator== documentation need more details

    XMLWordPrintable

Details

    • 3768a915bcf6aecf6bb445d7a6abfb78e505b4d7 (qt/qtbase/dev) 2cd77a1e22999d184708fec05ebc226eacec65cb (qt/qtbase/5.15)

    Description

      The documentation says that the colors are equal if they have the same RGB and
      alpha values (see: https://doc.qt.io/qt-5/qcolor.html#operator-eq-eq ).
      However, It appears that also the types of colors are checked. Like if two colors with different spec, but same RGB and same alpha values, == returns false.

          QColor col1(255, 255, 255, 255);
          QColor colHSV = col1.toHsv();  // copy of the color above in a HSV format
      
          qDebug() << "RGBAs are equal - " << (col1.rgba() == colHSV.rgba());      // Return true
          qDebug() << "Names are equal - " << (col1.name() == colHSV.name());  // Return true
          qDebug() << "Colors are equal - " << (col1 == colHSV);                 // Return False
      

      Documentation should include this detail too.

      Attachments

        For Gerrit Dashboard: QTBUG-84436
        # Subject Branch Project Status CR V

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            shmittal Shveta Mittal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes