
Originally Posted by
gtthang
Hi all,
I can change the text color of a QPushButton object using the QPalette::ButtonText attribute but I don't know how to change the background color of that button?
I tried the QPalette::Button, QPalette::Background,... but nothing changes.
Help me!
Thanks very much!
Well it works fine for me....on WinXP and SuSE 9/10
here's my snippet
QPalette pal
=palette
();
//get button palette pal.
setBrush(QPalette::Button,Qt
::black);
//makes my button blackpal.
setBrush(QPalette::ButtonText, Qt
::white);
mybutton.setPalette(pal);
QPalette pal=palette(); //get button palette
pal.setBrush(QPalette::Button,Qt::black); //makes my button black
pal.setBrush(QPalette::ButtonText, Qt::white);
mybutton.setPalette(pal);
To copy to clipboard, switch view to plain text mode
I presume you are doing the same...I am just confirming it's working! 
Nupul
Bookmarks