Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
5.14.2
-
None
Description
For some RGB values, the final QRgb value obtained by converting RGB to HSL and then back to RGB is not equal to the value before conversion
bug rgb examples: 254, 2, 0 、 254, 4, 0 ......
code demo:
#include "mainwindow.h" #include <QApplication> #include <QColor> int main(int argc, char *argv[]) { QApplication a(argc, argv); QRgb preCol = qRgb(254, 2, 0); //pre is 4294836736 qreal h, s, l; QColor rgbColor(preCol); rgbColor.getHslF(&h, &s, &l); QColor hslColor; hslColor.setHslF(h, s, l); QRgb afterCol = hslColor.rgb(); //rgb --> hsl --> rgb after is 4294836480 Bug is different from before rgb }
after QRgb 4294836480 equal to rgb:254, 1, 0 wrong!