Hi, I need to re-implement a one-level menu bar from a simple QWidget object. I have a list of registered actions with associated QPushButton instances. When the user clicks on a push button, the relative action is triggered.

I want to implement a generic "triggered(QAction*)" signal in my custom menu bar class, so how can I find the exact triggered action when the user clicks on a menu button?

I've tried a lot of solutions, without success:

  • connect(action, SIGNAL(triggered()), this, SLOT(onAction())) -> QAction doesn't have a "isTriggered" method or something similar to use in "onAction" function.
  • installEventFilter -> it doesn't work with actions...
  • Reimplement "actionEvent" method -> it isn't called when an action is triggered.