[Interest] set QPushButton pixmap by stylesheet

André Somers andre at familiesomers.nl
Thu Mar 14 13:52:35 CET 2013


Op 14-3-2013 13:41, Hamish Moffatt schreef:
> 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..
>
>
You can set any property using a style sheet, including the minimum 
size. Perhaps that helps already?

André

-- 
You like Qt?
I am looking for collegues to join me at i-Optics!




More information about the Interest mailing list