[Qt-interest] Multiple SIGNAL connected to single SLOT and sender() function
Sambhav
isambhav at gmail.com
Tue Nov 10 16:57:20 CET 2009
Thanks for the solution. But sender function is returning NULL.
Do i need to enable/set anything to use this feature.
On Tue, Nov 10, 2009 at 9:17 PM, Josiah Bryan <jbryan at productiveconcepts.com
> wrote:
> Sambhav wrote:
>
>> 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 QObject::sender <
>> https://mail.google.com/mail/html/compose/static_files/qobject.html#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.
>>
>
> QPushButton *btn = dynamic_cast<QPushButton*>(sender());
> if(btn)
> // do something with your push button
>
> Thanks and Regards,
>> Sambhav
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
> --
>
> -=-=-=-=-=-=-=-=-=-=-=-=-
> Josiah Bryan
> Productive Concepts, Inc.
> jbryan at pciint.com
> (765) 964-6009, ext. 224
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091110/284b7286/attachment.html
More information about the Qt-interest-old
mailing list