Hello to all,
I wish to color the background of a button with RGB,
ideas?
Thank you
Hello to all,
I wish to color the background of a button with RGB,
ideas?
Thank you
you can use style sheets or QPalette
Hello!
Try following as example:
Qt Code:
pb->setPlaette(p);To copy to clipboard, switch view to plain text mode
//where pb is QPushButton
I tried this code, but it just creates a red contour :s
thanks
Strange... It's working for me fine. What OS are you using?
yup, this code works fine.
visual studio 2005 + XP !
Please show your code and screenshot (if possible of course)
this is the code :
QPalette p = ui.pushButton->palette();
p.setColor(QPalette::Button, Qt::red);
ui.pushButton->setPalette(p);
the screenshot is not big thing, just a buton for test
ypp, I tried with sylesheet but the buton come not clickable:
ui.pushButton->setStyleSheet ("QPushButton {background : rgb(224, 0, 0); border-width: 2px; border-radius: 10px; border-color: beige; font: bold 14px; min-width: 10em; padding: 6px;}");
try this example.
thank you for the example, it works just with :
pushButton_2->setStyleSheet("QPushButton {background : rgb(224, 0, 0);}");
The first button has not changed (QPalette)
the second buton come not clickable![]()
Last edited by omega36; 30th October 2008 at 14:06.
Hi i think this code is working properly..
QPalette lPalette;
lPalette.setColor(pb1->backgroundRole(),QColor(255,0,0));
pb1->setPalette(lPalette);
the above code is correct and u try it...
where pb1 is ur pushbutton![]()
Bookmarks