yup, this code works fine.
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![]()
even if the above code is correct, but... nothing happend
and this is my solution : I create a red .png - for exemple - with "MacromediaFireWorks" ,
I convert it to .ico and it's work with this code :
ui.pushButton->setIcon(QIcon("./icon/28.ico"));
thanks to all![]()
it's not a solution. it's woraround. you have to find a problem.![]()
try to de the next thing, open Qt Designer, create a widget and put on it a QPushButton and play with a palette settings of this button. what will you see?
I dont see any thing
it's a temporary solution
did you do this in designer and color of button did not change?
ps. packed by 7zip
I'm talking about this
Qt Code:
.... pixmap.fill(Qt::red); ...To copy to clipboard, switch view to plain text mode
sorry I read it quickly
ok that is better![]()
Bookmarks