How to get QColor::greenF color value exactly between 0 and 1 instead of rounding off?
How to get QColor::greenF color value exactly between 0 and 1 instead of rounding off? I have a QColor value and I need to break it down into its RGB components between 0 and 1 with only one value after decimal point. For example: Orange color is QColor Orange color QColor color = QColor(255,128,0) qreal green = color.greenF(); qDebug() << green; //0.501960784 Whereas the green component must be 0.6 . That is, it's rgb value is (255,128,0) or (1,0.6,0). 0.6 rgb value is (255,128,0) or (1,0.6,0). How to get 0.6 instead of 0.501960784 ? 0.6 0.501960784 128/255 is not 0.6. Have you tried using 153 instead? – Angew Jul 1 at 19:57 @Angew But Orange color is 255,128,0 and '255,153,0' will be the different type of orange color. I have to map 0-255 range to 0-1 range to refle...