PDA

View Full Version : Converting Colorful Screen to Monochrome Display ??



cranberries
13th February 2015, 09:47
Hi all,
There is an app which includes colorful screens. And, I chould convert these screens to monochrome displays.
Is there any proposal which indicates a gap says that this color refers to black, and this color refers to white for monochrome. I mean, when I give the related color as param, I should get back black or white according to this gap.

Thanks in advance for the replies ,
Cranberries

d_stranz
13th February 2015, 15:36
If you set a customized QPalette or custom QStyle for the application, then all widget palettes / styles should inherit from the palette / style set in QApplication. If you want to convert an RGB color to gray use the qGray() function (see QColor for documentation). This returns a value between 0 - 255. If you want black or white only, then just divide this range in half and set everything < 128 to black, everything > 127 to white.