Unsolved QPushButton; "Blurry" stylesheet for checked buttons
-
I have two buttons in a button group, and I want the checked button to have a blue background with white text, and the unchecked button white background with blue text.
This my GUI setup:
mvLBtn = new QPushButton("btn1"); mvLBtn->setCheckable(true); mvLBtn->setChecked(true); mvMlBtn = new QPushButton("btn2"); mvMlBtn->setCheckable(true); QWidget *mvGrp = new QWidget; QButtonGroup *mvBGp = new QButtonGroup; mvBGp->addButton(mvLBtn); mvBGp->addButton(mvMlBtn); QHBoxLayout *mvLayout = new QHBoxLayout; mvLayout->setMargin(0); mvLayout->setSpacing(0); mvLayout->addWidget(mvLBtn); mvLayout->addWidget(mvMlBtn); mvGrp->setLayout(mvLayout);
This mvGrp widget is added the form later in a couple nested layouts.
This is my stylesheet:
this->setStyleSheet("QPushButton{margin: 0px; padding: 10px;}" "QPushButton:checked{background-color: blue; color: white;}" "QPushButton:!checked{background-color: white; color: blue;}");
For some reason, the checked button (btn1) is blurry on the form.
However, I've noticed that if I switch my stylesheet for checked vs !checked, the unchecked button does NOT have the same blurry affect.
Switched stylesheet:
this->setStyleSheet("QPushButton{margin: 0px; padding: 10px;}" "QPushButton:checked{background-color: white; color: blue;}" "QPushButton:!checked{background-color: blue; color: white;}");
Form with btn1 checked:
How can I get my form to have a solid blue background on checked buttons?