Unsolved How to change QCheckBox label size?
-
Hi,
I would like to have QCheckBox, which has fixed width, so I did:
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum); setFixedWidth(170); setStyleSheet("QCheckBox {background:red}"); // only to show real shape of checkBox
I get:
Now, when I clicked in the red area, checkBox doesn't change state ( checked / unchecked ). So I think I have to change the size of the pink area ( so the label, where is "TEXT" ).
-
@qwe3 said in How to change QCheckBox label size?:
Now, when I clicked in the red area, checkBox doesn't change state ( checked / unchecked )
Because the actual clickable area is the box + the text area. The red background area is just a kind of frame around it.
If you look into the source, you can see that there is a check, before the state is going to change. It checks whether the mouse hits the
CheckBoxClickRect
which is a subStyle element (your pink area).