Important: Please read the Qt Code of Conduct -

Can you nest QActionWidgets in a QMenu to emulate submenus?

  • Hello,

    I'm using a QActionWidget in a QMenu's submenu to render my own modified menu which works great on the first level, but when I get to an element in my QActionWidget that I'd like to further filter down into another submenu, I'm not seeing a way to do this since the QMenu handling ceases. Hopefully that makes sense, basically i want to emulate a QMenu w/ a dynamic number of submenus using QActionWidgets.

    Currently, when I find a menu item i want to expand into a submenu, I have it create a new menu w/ another QActionWidget and popup() that menu next to the original one, but this doesn't natively emulate how a menu should act when a user moves their mouse to a different parent menu item (closing the no longer relevent submenu) etc. Also, the event filters get limited to the newly created QMenu which makes it hard to try to emulate the proper handling on my own.

    Alternatively, is there a better solution for this? I basically need a menu that allows for 2 columns of text that justify nicely respective of all text in the menu entries.

    Thanks for any suggestions!

Log in to reply