[Qt-interest] Multiple SIGNAL connected to single SLOT and sender() function

Ivan Kharin korsar.akvis at gmail.com
Wed Nov 11 07:11:41 CET 2009


> For cases where you may require information on the sender of the
> signal, Qt provides the 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.

if ( QPushButton *btn = qobject_cast< QPushButton* >( sender() ) )
{
  // ....
}

-- 
Regards,
Ivan Kharin




More information about the Qt-interest-old mailing list