ntp
24th April 2008, 21:12
I have a push button that I want to always look red even when I have done setChecked(true) to keep it depressed.
I have this:
m_fourButton->setStyleSheet(QString("QPushButton {background-color: red;} QPushButton:checked{background-color: red;} QPushButton:pressed {background-color: red;}"));
I also tried background:red.
I started with QPalellete which gives me the same results.
m_redPalette.setColor(QPalette::Button, Qt::red);
QBrush brush;
brush.setColor(Qt::red);
m_redPalette.setBrush(QPalette::Window, brush);
and tried everything that Palette would let me for Color Roles.
The result is that it is red when it is not checked but only the border is red when it is checked (depressed). Is there anything else I can do to make the pressed button red?
I've attached a zip file with an image of the buttons (it wouldn't let me upload my .bmp file).
Thanks
I have this:
m_fourButton->setStyleSheet(QString("QPushButton {background-color: red;} QPushButton:checked{background-color: red;} QPushButton:pressed {background-color: red;}"));
I also tried background:red.
I started with QPalellete which gives me the same results.
m_redPalette.setColor(QPalette::Button, Qt::red);
QBrush brush;
brush.setColor(Qt::red);
m_redPalette.setBrush(QPalette::Window, brush);
and tried everything that Palette would let me for Color Roles.
The result is that it is red when it is not checked but only the border is red when it is checked (depressed). Is there anything else I can do to make the pressed button red?
I've attached a zip file with an image of the buttons (it wouldn't let me upload my .bmp file).
Thanks