SignalsSpy allow you to track QObjects' signals emissions. It's the opposite of QSignalMapper. Track all signals from a single object.
copy the files in the directory of your project, add the file to your .pro
and enjoy (qmake
may be necessary).
- QObject * object : the object to monitor and the parent of the SignalsSpy.
- emitted(QString signature) : send the signature of the signal that just been emitted, like
"valueChanged(int)"
- emittedNameOnly(QString name) : send the name of the signal that just been emitted, like
"valueChanged"
QPushButton * button = new QPushButton("click me!");
SignalsSpy * spy = new SignalsSpy(button);
connect(spy, SIGNAL(emitted(QString)), button, SLOT(setText(QString)));
When you'll click the button, the displayed text should go through something like : pressed, released, clicked( bool ), clicked