Styled PushButton in checked state
-
Hi,
QPushButton:checked {background-color: green; border: none;}
will do what you want
-
You were missing the
:
beforechecked
so
":checked {background-color: green ; border: none;}"
will also work -
-
AFAIK, you can't, however you can still re-use it by using something like:
QString styleSheet("%1:checked {background-color: lightgreen; border: 1px solid;} " "%1 {background-color: red; border: 1px solid; padding: 6px}"); myWidget->setStyleSheet(styleSheet.arg(myWidget->metaObject()->className()));