Written by marcelpetrick
on August 27, 2017
Sometimes several signals lead to one single slot. Without any parameter. So you are stuck and can’t find out who was the ‘caller’.
But wait, there is a nasty hack to find it for those which are direct connections.
1 2 3 4 5 6 7 8 9 |
#include <QtCore/QMetaObject> #include <QtCore/QMetaMethod> [..] { //todom just for testing QMetaMethod const metaMethod = sender()->metaObject()->method(senderSignalIndex()); qDebug() << "invoking caller: name and signature:" << metaMethod.name() << "|" << metaMethod.methodSignature(); } |
Leave a Reply
You must be logged in to post a comment.