[Interest] set QPushButton pixmap by stylesheet
Hamish Moffatt
hamish at risingsoftware.com
Thu Mar 14 14:13:11 CET 2013
On 14/03/2013 11:52 PM, André Somers wrote:
> 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?
> You can set any property using a style sheet, including the minimum
> size. Perhaps that helps already?
>
>
Yes it does; I misread the style sheet reference and didn't realise the
image property applied to QPushButton (d'oh!). I find it's also
necessary to set the background to transparent else I see the default
button style instead of the icon.
It doesn't seem to set its minimum size according to the image though (I
was hoping to avoid manually specifying all the image sizes in the
stylesheet). If I specify min-width and min-height I get what I want.
Omitting those seems to be resulting in a default minimum size with the
image being scaled.
The stylesheet reference mentions the icon-size property - how do I use
that to describe both height and width? It is defined as a length, which
is only in one dimension.
thanks,
Hamish
More information about the Interest
mailing list