PDA

View Full Version : How to get pushbutton as an icon



Pembar
12th May 2009, 15:04
Hello,

I have a simple problem which I can't seem to find in the API. I have an icon in png format, say 32x32. I'd like to create a pushbutton of size 90x90 which displays the entire icon, enlarged. But only one copy of the icon should be displayed, not multiple overlapping ones as defined in setstylesheets.

I've tried both seticon and setstylesheets. Set icon doesn't enlarge the icon, while setstylesheets makes many copies of the icon until the button is filled.

Any help would be appreciated, Thanks.

Regards,
Pembar

wysota
12th May 2009, 19:59
You can't obtain what you want with the default Qt widgets. You either need to subclass the button class and scale the icon yourself before painting it or use QLabel instead of the button but then you'll have to provide the clicking functionality yourself. Just remember that images scaled up look very bad so rethink your approach before you start implementing anything.