c++ - Qt checkbox/toolbutton with custom/distinct check/unchecked icons -
i need have checkbox control checked , unchecked states use custom graphic. i've looked @ docs qtoolbutton , qcheckbox, along qicon couldn't find combination want.
i want use 1 icon (pixmap actually) in unchecked state, , different 1 in checked state.
this feels should easy, solution (short of custom control) eluding me.
i've tried using style sheet well, , qtoolbutton:checked
background-image
kind of works can't layout correct -- it's not positioned/sized icon.
use ::indicator sub-item. code below works excellent me...
qcheckbox::indicator { width: 18px; height: 18px; } qcheckbox::indicator:checked { image: url(.../checkbox_checked_normal.png); } qcheckbox::indicator:unchecked { image: url(.../checkbox_unchecked_normal.png); } qcheckbox::indicator:checked:hover { image: url(.../checkbox_checked_hovered.png); } qcheckbox::indicator:unchecked:hover { image: url(.../checkbox_unchecked_hovered.png); } qcheckbox::indicator:checked:pressed { image: url(.../checkbox_checked_pressed.png); } qcheckbox::indicator:unchecked:pressed { image: url(.../checkbox_unchecked_pressed.png); } qcheckbox::indicator:checked:disabled { image: url(.../checkbox_checked_disabled.png); } qcheckbox::indicator:unchecked:disabled { image: url(.../checkbox_unchecked_disabled.png); }
Comments
Post a Comment