[Qt-interest] Set background color of a QPushButton for Windows XP
Valentina Masi
valentina.masi at altran.it
Fri Sep 17 11:49:02 CEST 2010
Hi all
In my Qt application I have to set the background color for some QPushButton to another color from default color.
My app runs in Windows XP and I need to use Windows XP style (not classic Windows style).
I tried as follows:
QPalette palette = myPushButton->palette();
QBrush brush(QColor(255, 0, 0, 255)); // red
brush.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Button, brush);
palette.setBrush(QPalette::Inactive, QPalette::Button, brush);
palette.setBrush(QPalette::Disabled, QPalette::Button, brush);
myPushButton->setPalette(palette);
But it works only if I set classic Windows style.
I also tried to use stylesheet but the problem remained.
Can anyone help me?
Thanks in advance
Valentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100917/a4fef7d9/attachment.html
More information about the Qt-interest-old
mailing list