QAction trigger source
-
Hi,
is there any way to distinguish how QAction was triggered? particularly I need to know is an action was selected from a menu or triggered by a shortcut...
-
You can use:
@
sender()->objectName();
@But I think you should find an other solution (using 2 separate QActions, perhaps?_.
-
sender() is a free function?
2 separate actions... I'm talking about KDE application actually, so user will see both in 'Configure Shortcuts' dialog which is definitely not good...
-
Not sure what you mean by "free", but it is available in every QObject. See the "documentation":http://qt-project.org/doc/qt-5/qobject.html#sender.
-
in C++ "free function" term means a non-member function... i.e. declared in a namespace/global scope.
-
Toy have the answer in the documentation, then: it's a member of QObject.