Hi!
I need to catch all signals emitted from a widget using QSignalSpy (or something else), is there a way to do that? It can by only number of those signals without any other info.
Hi!
I need to catch all signals emitted from a widget using QSignalSpy (or something else), is there a way to do that? It can by only number of those signals without any other info.
You can list all signals of a type by iterating over the methods of its QMetaObject and checking for QMetaMethods for signals.
You could then create a list of signal spys, each connected to one signal, or connect all signals to a custom slot in a receiver object.
Cheers,
_
If somebody want to know how to do that I paste my code.
Qt Code:
#include <QSignalSpy> class QAllSignalSpy : public QList<QSignalSpy*> { public: int metaCount = me->methodCount(); for(int i = 0;i<metaCount;i++){ } } } int signalCount(){ int all = 0; for(int i=0;i<this->size(); i++) all += this->at(i)->count(); return all; } };To copy to clipboard, switch view to plain text mode
enjoy!
MarPan (14th April 2015)
I have just published a tiny header-only library which does exactly this: QSignalInspector
Bookmarks