Style Sheets: QRadioButton::setIcon() conflicts with icon set in stylesheet?
-
I am trying to style the QRadioButtons/QCheckBoxes in my application. For using custom icons, the documentation says something like this:
@QRadioButton::indicator::unchecked {
image: url(:/images/radiobutton_unchecked.png);
}@Which is fine so far. But some QRadioButtons come with an icon, and so do some of the QCheckBoxes. Now their icon is being overlayed by the one set in the stylesheet.
Is there something I can do to differentiate between QRadioButtons/QCheckBoxes that already have an icon and ones that come without one?EDIT : I am using "generated" QRadioButtons etc., meaning that they are based off of a QAction. Maybe that causes the "double icon"?
-
Hi,
what do you mean with some of them come with an icon ?
Anywhay this is how i styled a checkbox before, which works perfectly. Ofcourse some attributes you won't need, but anyways:
@
QCheckBox{
font-family: "Arial";
font-size: 20px;
font-style: normal;
font-weight: bold;
border-style: none;
}QCheckBox::indicator {
width: 64px;
height: 64px;
}QCheckBox::indicator:unchecked {
image: url(:/images/checkbox_unchecked.png);
}QCheckBox::indicator:unchecked:hover {
image: url(:/images/checkbox_unchecked_hover.png);
}QCheckBox::indicator:checked {
image: url(:/images/checkbox_checked.png);
}QCheckBox::indicator:checked:hover {
image: url(:/images/checkbox_checked_hover.png);
}@
-
If I e.g. make a QAction (including icon) checkable, it act's like a QCheckBox with an icon (no style sheet involved yet). Now inside the style sheet I set another icon, and both lay on top of each other, which is obviously very ugly.