I\'m trying to change the Icon of a QpushButton on hover and pressed, I\'m using QtDesigner with stylesheets. I tried this
QpushButton{
qproperty-icon:ur
After reading this article and encountering similar issues. This is my work around in c++ not using style sheet from designer.
1>I create Icons one for being pressed and one for normal. In your case we would address it as the hover condition.
2>Add the icons to the resource file.
3>Use the following code for reference...
Where Add_PB is a QPushButton.
Add_PB->setStyleSheet( "*{border-image: url(:/icons/maximize.bmp);}"
":pressed{ border-image: url(:/icons/maximize_pressed.bmp);}");
The key take away here is you can use setStyleSheet to set diffrent icons for different conditons. I couldnt get the above code to work until I used the * operator or "Universal Selector" in the CSS string.
Reference: http://doc.qt.io/qt-5/stylesheet-syntax.html