PDA

View Full Version : On press of a pushbutton,the pushbutton image should be different



ranjit.kadam
29th April 2011, 07:05
hello freinds,I have added an background image to a pushbutton ,now when i press this pushbutton,a diffrent image should happen on oushbutton so that the user gets a feel that the button has been pressed..so how shall i do it..




regards
ranjit

stampede
29th April 2011, 08:14
QPushButton has clicked() signal, connect it to a slot and change the image there.
signals and slots docs (http://doc.qt.nokia.com/latest/signalsandslots.html)

Lykurg
29th April 2011, 08:40
You have to subclass QPushButton and do the paint your self. By using QStyledPainter it is not so complicated. Then inside the paint method check for isDown() and react on it.

Qiieha
29th April 2011, 09:54
You can set up different pictures for the several QPushButton states in the Qt designer...