PDA

View Full Version : QImage on QPushButton



emaborsa
11th May 2011, 08:45
Hi, i used QPixmap and QImage to load an image into a label. The problem here is that i have no clicked() as signal to connect it. Another user suggested me to use QPushbuttn and set it to flat, so i used QIcon to add che image, but doing this the image is only a little icon. Is there the possibility to enlarge it, or another class to use instead the QIcon?

Octal
11th May 2011, 09:44
You could try calling setIconSize (http://doc.qt.nokia.com/4.7/qabstractbutton.html#iconSize-prop) on your button.

Lykurg
11th May 2011, 09:45
Use QAbstractButton::iconSize. Or stick to the label and add your own click signal reimplementing the mouse press and release event.

mvuori
11th May 2011, 09:47
In some other forum a user realised the answer to be "Ah, sorry. So it really is as simple as inheriting from [that is: subclassing] a QLabel and reimplementing the mousePressedEvent or mouseReleaseEvent." -- you can call your custom signal from those.

emaborsa
11th May 2011, 11:12
You could try calling setIconSize (http://doc.qt.nokia.com/4.7/qabstractbutton.html#iconSize-prop) on your button.

Damn...so simple. Sometimes i'm able to arrange very complex things, and sometimes i overlook simple stuff like this.
However, thanks.