How to intercept ALL signals emitted by a given event in Qt?

I don't think this is possible with Qt. You can

  • list all signals of a class using QMetaObject::method and QMetaMethod::methodType;
  • attach one of your own slots to all of those signals;
  • check who invoked a slot using QObject::sender.

But I'm stuck after this. I don't think that, besides the sender, any information can be obtained about how a slot got invoked.


You may want to take a look at the QSignalSpy class. I think though you have to connect manually the signal you want to spy.


This isn't possible with any public API.

But, if you put your code into a QTestLib-based unit test, you can run the unit test with -vs to print out every emitted signal.