Reputation: 1022
in Qt it is possible to specify the background color of QWizard Page?
Using setColor
in QPallete::Base
of the qApp
of, if using a generic window, the background changes to the correct color.
However, if using a QWizard
or QWizardPage
, the background is set to white.
Using
qApp->setStyleSheet("QWidget { color: #000000; background-color: #2a82da; border: 1px solid white; } ");
the color changes, but a lot of other elements also change to that color(all the widgets).
How is it possible to specify the color change to QWizard
or QWizardPage
?
Thanks in advance
Upvotes: 0
Views: 1435
Reputation:
In Qt5 when you change background color.
QWizard
- QPalette::Window
- place near bottom buttonsqDebug()<< QWizardPage->backgroundRole();
get us QPalette::ColorRole(Window).
But it's not true, real value is QPalette::Base
Code:
QPalette
bgpal
bgpal.setColor(QPalette::Base, Qt::white);
setPalette(bgpal);
this->setAutoFillBackground(true);
`this->setBackgroundRole(QPalette::YourPalette)`; don't recommend to use, on olds Qt it has a bug.
P.S. Ye, it has the same role as lineEdit background and if you set to QLE border 0 you will get:
Upvotes: 0
Reputation: 691
I had the same problem and here is the solution.
Assume I have a child class of QWizard
:
this->setObjectName("wizard");
this->setStyleSheet("#wizard { background : #f4f7f9; ");
changes the wizard background color without affecting other elements.
Upvotes: 2
Reputation: 1022
Well, this seems to work:
QWizard wizard;
wizard.setStyleSheet("background-color:#E8E8E8");
Upvotes: -1