c++ - Custom checkable / toggleble QFrame widget -
c++ - Custom checkable / toggleble QFrame widget -
how can create custom widget (derived "qframe") contain back upwards checkable/toggleble? how create qt's stylesheet (css) aware widget checked/toggled user?
is there kind of signal or property need utilize in custom widget?
i don't want utilize (i.e.) qpushbutton because need button widget utilize qt's .ui file.
i.e. when using qpushbutton - things 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 similar custom button widget.
thanks.
you can utilize hover
, focus
custom widget, checked
supported buttons , check boxes only.
to replace checked
can utilize custom property:
qpushbutton#btnname[checked="true"] { border-image: url(themespathkey/menu-top-h.png); }
when widget clicked toggle checked
property this:
void mousepressevent(qmouseevent*) override { bool checked = property("checked").tobool(); setproperty("checked", !checked); style()->polish(this); }
c++ css qt widget qframe
Comments
Post a Comment