QPushButton - not working setIcon in Active state
-
QIcon icon;
icon.addFile(":/25.png", QSize(), QIcon::Normal); - ok
icon.addFile(":/25_hover.png", QSize(), QIcon::Active); - fails
icon.addFile(":/25_disabled.png", QSize(), QIcon::Disabled); - okQPushButton button;
button.setIcon(icon);When mouse hover the button (button is Active), but icon of the button in state Normal, why?
-
The Active state can mean different things for different widgets. For push button hover and active are two different things. A button becomes active when it has focus (e.g. after a click or via keyboard tabbing to it). Hovering is not the same as it can occur over an inactive button too.
To style a button when mouse hovers over it you can use a stylesheet. -
[quote author="Chris Kawa" date="1423590349"] A button becomes active when it has focus (e.g. after a click or via keyboard tabbing to it). Hovering is not the same as it can occur over an inactive button too.[/quote]
Sorry, Chris, do you know when QCheckBox becomes Active?
-
bq. do you know when QCheckBox becomes Active?
An intuition would suggest the same situation - clicked or navigated via keyboard, but apparently it doesn't respect the icon change on that soo... I don't know. Possibly a Qt bug?