[Interest] set QPushButton pixmap by stylesheet

Hamish Moffatt hamish at risingsoftware.com
Thu Mar 14 13:41:20 CET 2013


Is it possible to set the name of the icon for a QPushButton (and also 
possibly the pixmap for a QLabel) via the stylesheet?

I'm trying to centralise all the image filenames etc in the stylesheet 
so that I can easily choose between different stylesheets depending on 
the screen resolution, rather than having to update filenames on a 
variety of widgets at runtime.

I've achieved most of what I need via the background-image, 
background-repeat (no-repeat) and background-position properties, but I 
want the QPushButton to automatically set its minimum size to the 
dimensions of the icon. So it's not really a background image. Although 
since QPushButton has an icon size property (in Designer) perhaps it 
never does that anyway..



thanks
Hamish



More information about the Interest mailing list