[Qt-interest] QPalette on PushButton

Zeljko zeljko at holobit.net
Sat Jan 31 08:47:55 CET 2009


chandrasekar wagmare wrote:

> hi friends,
> i try to display different color with respect to the input ..
> 
> so to set the color value i use three variable rd , gr , bl and i use it
> as QColor(rd,gr,bl)
> 
> using i program as
>                 QPalette p;
>                 p.setColor(QPalette::Background,QColor(rd,gr,bl));
>                 Button->setPalette(p);
>                 1Button->setPalette(p);
>                 2Button->setPalette(p);
>                 cButton->setPalette(p);
>                 1Label->setPalette(p);
>                 2Label->setPalette(p);
>                 3Label->setPalette(p);
>                 4Label->setPalette(p);
> 
> here all the labels are displaying the color but
> pushButtons are not displaying the background colors ... why?

You must use QPalette::Button & QPalette::ButtonText for QPushButton colors.




More information about the Qt-interest-old mailing list