[Qt-interest] Multiple SIGNAL connected to single SLOT and sender() function
André Somers
andre at familiesomers.nl
Wed Nov 11 07:58:15 CET 2009
You can do that by casting. This is a basic C++ thing, by the way. There are different types of cast available, Google will inform you on those. One notable one though is provided by Qt itself: qobject_cast. You may use it.
However:
There is a better way to do what you want. Take a look at QSignalMapper.
André
Van: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] Namens Sambhav
Verzonden: dinsdag 10 november 2009 16:46
Aan: qt-interest at trolltech.com
Onderwerp: [Qt-interest] Multiple SIGNAL connected to single SLOT and sender() function
Hi,
I want to connect multiple QPushButton(s) to a single SLOT. In the SLOT it is required to change the certain properties of the Button. I checked the documentation and found this under signal and slots page.
Advanced Signals and Slots Usage
For cases where you may require information on the sender of the signal, Qt provides the <https://mail.google.com/mail/html/compose/static_files/qobject.html#sender> QObject::sender() function, which returns a pointer to the object that sent the signal.
I want to know how to convert the QObject returned by the sender function to the QPushButton object.
Thanks and Regards,
Sambhav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091111/76bed42b/attachment.html
More information about the Qt-interest-old
mailing list