Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Context menus: trigger an action on an item that has a sub-menu.
pezzi last edited by
I am building context menus with submenus - and I can trigger an action on the submenu. But I would also like to trigger an action on the item that has a sub-menu. In the code below, as_action triggers nicely, but the a_action does not. Same for the hovered signal.
So how can you trigger an action when you click on a menu which has a submenu?
This is Python/PySide code btw.
menu = QtGui.QMenu()
a_action = QtGui.QAction(cat, menu)
a_submenu = QtGui.QMenu(name)
for i in subs:
as_action = QtGui.QAction(i, a_action)
andre last edited by
You don't. The action is "show the sub menu". It would be very confusing if the action does more than that.