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);
buttonH1->setAutoFillBackground (true);
To copy to clipboard, switch view to plain text mode
and then I've tried this
buttonH1->setPalette(Qt::green);
buttonH1->setPalette(Qt::green);
To copy to clipboard, switch view to plain text mode
and this
palette.
setColor(QPalette::Button, Qt
::green);
buttonH1->setPalette(palette);
QPalette palette;
palette.setColor(QPalette::Button, Qt::green);
buttonH1->setPalette(palette);
To copy to clipboard, switch view to plain text mode
and this
palette.setColor(buttonH1->backgroundRole(), Qt::green);
buttonH1->setPalette(palette);
palette.setColor(buttonH1->backgroundRole(), Qt::green);
buttonH1->setPalette(palette);
To copy to clipboard, switch view to plain text mode
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);
//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);
To copy to clipboard, switch view to plain text mode
Could somebody please tell me what I need to do?
thanks
K
Bookmarks