TheKedge
2nd November 2006, 12:33
I'm sorry about this, I know there are lots of threads changing the colours of widgets, but it's just not working for my QPushButton.
I do this first
buttonH1->setAutoFillBackground (true);
and then I've tried this
buttonH1->setPalette(Qt::green);
and this
QPalette palette;
palette.setColor(QPalette::Button, Qt::green);
buttonH1->setPalette(palette);
and this
palette.setColor(buttonH1->backgroundRole(), Qt::green);
buttonH1->setPalette(palette);
I get a green 'lining' around the button and/or green text but the button itself remains grey.
I've also tried setting all the palette to green, as below. I don't get a green button.
//palette.setColor(QPalette::Window, Qt::green);
//palette.setColor(QPalette::Background, Qt::green);
//palette.setColor(QPalette::WindowText, Qt::green);
//palette.setColor(QPalette::Foreground, Qt::green);
//palette.setColor(QPalette::Base, Qt::green);
//palette.setColor(QPalette::AlternateBase, Qt::green);
//palette.setColor(QPalette::Text, Qt::green);
palette.setColor(QPalette::Button, Qt::green);
//palette.setColor(QPalette::ButtonText, Qt::green);
//palette.setColor(QPalette::BrightText, Qt::green);
Could somebody please tell me what I need to do?
thanks
K
I do this first
buttonH1->setAutoFillBackground (true);
and then I've tried this
buttonH1->setPalette(Qt::green);
and this
QPalette palette;
palette.setColor(QPalette::Button, Qt::green);
buttonH1->setPalette(palette);
and this
palette.setColor(buttonH1->backgroundRole(), Qt::green);
buttonH1->setPalette(palette);
I get a green 'lining' around the button and/or green text but the button itself remains grey.
I've also tried setting all the palette to green, as below. I don't get a green button.
//palette.setColor(QPalette::Window, Qt::green);
//palette.setColor(QPalette::Background, Qt::green);
//palette.setColor(QPalette::WindowText, Qt::green);
//palette.setColor(QPalette::Foreground, Qt::green);
//palette.setColor(QPalette::Base, Qt::green);
//palette.setColor(QPalette::AlternateBase, Qt::green);
//palette.setColor(QPalette::Text, Qt::green);
palette.setColor(QPalette::Button, Qt::green);
//palette.setColor(QPalette::ButtonText, Qt::green);
//palette.setColor(QPalette::BrightText, Qt::green);
Could somebody please tell me what I need to do?
thanks
K