How can I make a custom widget (derived from "QFrame") contain a support to be checkable/toggleble? How to make Qt's stylesheet (CSS) to be aware that my widget was checked/toggled by user?
Is there some kind of signal or property that I need to use in my custom widget?
I don't want to use (i.e.) QPushButton because I need my button widget to use Qt's .ui file.
I.e. when using QPushButton - things are simple:
QPushButton#btnName:focus:pressed { border-image: url(ThemesPathKey/menu-top-h.png); }
QPushButton#btnName:checked { border-image: url(ThemesPathKey/menu-top-h.png); }
QPushButton#btnName:hover { border-image: url(ThemesPathKey/menu-top-h.png); }
I need something similar for my custom button widget.
Thanks.
You can use
hover
andfocus
for a custom widget, butchecked
is supported for buttons and check boxes only.To replace
checked
you can use a custom property:when your widget is clicked toggle
checked
property like this: