[Qt-interest] Calling a slot when clicking on label

Andre Somers andre at familiesomers.nl
Wed Aug 4 15:39:50 CEST 2010


Op Wo, 4 augustus, 2010 2:44 pm, schreef Nishant Sharma:
> Hi,
> I want to call a slot/function when I click on a QLabel.
> Please suggest how to do that.
> I am using qt version- 3.3.6
>
> --
> Best Regards,
> Nishant Sharma
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
You will need to derive your own subclassed verion of QLabel and handle
the mouse click event to emit a signal. Then connect that signal to your
slot.
Perhaps you could use a button instead, and if you insist, make it look
like a label?

André





More information about the Qt-interest-old mailing list