[Interest] [OS X] reusing QMenu and QActionWidget instances

René J.V. Bertin rjvbertin at gmail.com
Sun May 1 11:22:17 CEST 2016


Hello,

What's the correct way to set up a QMenu or QActionWidget instance and add it to more than 1 menu on OS X?

I haven't yet understood the exhaustive reasons, but lots of cross-platform code (KF5 ...) gives me warnings (errors?) about *certain* items being added (removed) that are already (also) part of another menu. From the documentation I understand that this is related to reparenting when adding the action to the toplevel menubar, but it seems I'm also getting those warnings for actions that to the best of my knowledge are used in context menus only. It may be that this only happens when those items are part of an actionCollection that "serves" multiple menus.

Either way, it looks like having multiple, identical QMenu* or QActionWidget* (or QAction*, when going through an actionCollection) instances should solve the issue, but is it possible to clone such an instance and if so, how? 

Thanks,
René



More information about the Interest mailing list