smoon
10th March 2011, 23:08
Hi,
how can I set the background of a button without using stylesheets? I tried to do this with something like that:
pushbutton_ontop->setAutoFillBackground(true);
pushbutton_ontop->setBackgroundRole(QPalette::Button);
QPalette p = pushbutton_ontop->palette();
p.setColor(QPalette::Button, Qt::red);
pushbutton_ontop->setPalette(p);
But with no luck.
If I use stylesheets I can set the background color, but the whole button style is gone after that :(
Hope someone has a good idea...
how can I set the background of a button without using stylesheets? I tried to do this with something like that:
pushbutton_ontop->setAutoFillBackground(true);
pushbutton_ontop->setBackgroundRole(QPalette::Button);
QPalette p = pushbutton_ontop->palette();
p.setColor(QPalette::Button, Qt::red);
pushbutton_ontop->setPalette(p);
But with no luck.
If I use stylesheets I can set the background color, but the whole button style is gone after that :(
Hope someone has a good idea...