Is there any way to change background color of widget without loosing of it's style? My problem is reproducible on Windows 7/Vista with Aero theme and on Windows 8 too. You can see how it looks in Qt Designer:
Here we have four buttons: both top widgets looks good (as all other widgets of this program), but both bottom widgets looks old. The only reason of this old style is setting of background color of these buttons (as far as I understand, Desktop Window Manager resets style to old if widget is not standard).
So, is there any way to force Desktop Window Manager to draw button with not standard background color? (Microsoft Office can do it, but I am not sure it is standard feature)
Could you recommend Qt extension which replaces standard drawing of buttons by modern (Aero theme)? Or may be you know more standard way to do it?
I found only one way to change color without loosing of style: to put partially transparent widget above button (and to make it transparent for mouse clicks). You can see the result here (my frame is bigger than it is necessary - it is for demonstration; also I need color correction to compensate transparency, but it is not critical):
It works, but I don't like this "solution". Do you have better idea?
I see that you are using stylesheets to modify the background colour of the buttons. I had faced the same problem a while ago. As soon as you apply a stylesheet, button looses the 3rd effect and you don't see hover effect as well.
My take on it was to discard using stylesheets and use QPalette
to set the colours. For example,
QPalette bluePalette(button->palette()); // original palette
bluePalette.setColor(QPalette::Button, QColor(Qt::blue)); //colour you want
button->setPalette(bluePalette);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With