[Qt-interest] How to find out which SIGNAL was sent

NoRulez norulez at me.com
Thu Nov 18 09:41:04 CET 2010


Hello,

 

how can I find out which signal was sent from a specific widget/QObject?

For example:

 

connect (myWidget1, SIGNAL(sig1()), this, SLOT(doSomething()));

connect (myWidget1, SIGNAL(sig2()), this, SLOT(doSomething()));

connect (myWidget2, SIGNAL(sig1()), this, SLOT(doSomething()));

connect (myWidget2, SIGNAL(sig2()), this, SLOT(doSomething()));

 

 

void MyClass::doSomething() {

      qDebug() << sender(); // myWidget1, MyWidget2

}

 

To find out the widget is simple, just call sender(), but how can I get the
signal which was sent (in this example sig1() or sig2())?

 

Thanks in advance

 

Best Regards

NoRulez

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101118/5558f3d0/attachment.html 


More information about the Qt-interest-old mailing list