I need to change the background image of a QPushButton when its state is pressed. I tried with this css:
QPushButton { background: transparent; border: none;}
QPushButton:pressed { image: url(\mypath\settings_press.png); }
but a runtime I got the following error:
Could not parse stylesheet of widget
Any idea?
All of the examples of Qt stylesheets I’ve seen use UNIX style paths, so your CSS should look like:
Also, URLs for Qt stylesheets need to be a relative path to a Qt resource like:
or absolute paths like:
I would go the resource route unless you can absolutely guarantee the install path of your image.