View Full Version : Adjust gui brightness

12th September 2009, 21:09

I would like to add functionality for adjusting the brightness of the gui to my app. So that the color of text, buttons, ... could be changed to a lighter or darker color by the user.

I've seen that there is the possibility to define style sheets but as I would like to have about 100 brightness steps 100 hand edit qss files isn't that nice.

Thank you for all ideas. I really need this.


PS: I'm using Qt 4.5.1

13th September 2009, 09:41
Take a look here (Issue 29, Translucent Widgets in Qt) (http://doc.trolltech.com/qq/), maybe it's what you're looking for.

15th September 2009, 22:44
@cydside Could you specify how translucet widgets can help me changing the color of all the gui widgets in my window to a darker or lighter color?



16th September 2009, 06:32
Cant say about the translucent widgets... but you can try the following with style sheets -
Define your style sheet with some variable multiplied by brightness... something like -

background-color: rgb(234* _BRIGHTNESS_ , 134* _BRIGHTNESS_ , 34* _BRIGHTNESS_ );

Then read the style sheet in your code, replace the _BRIGHTNESS_ with your desired value ( 0-1) and apply the style sheet.

Hope this will give you the desired effect :)