[Qt-interest] inherit QPushButton and implement clicked()?

Arnold Krille arnold at arnoldarts.de
Sat Feb 27 23:38:03 CET 2010


On Saturday 27 February 2010 22:28:19 Sebastian Songemann wrote:
> I created a custom button and inherited QPushButton. The button should
>  notice when it has been clicked. Can I implement a method that is called
>  as soon as the button is clicked? (I've tried clicked(), but no luck.)
> Of course, I could connect the clicked() signal to a private slot and then
>  emit another signal, but this should be easier. I can, for example, just
>  implement mouseMoved() without having to connect a signal and slot in
>  QWidget.

Why are you sub-classing the button in the first point?
And why would you create a private slot connected to "clicked()" just to emit 
another signal???

The signals/slots are exactly meant for what you are trying: Triggering 
actions (called slots) on objects that you don't know when the button is 
implemented.


Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100227/141dba26/attachment.bin 


More information about the Qt-interest-old mailing list