[Interest] menu item reuse and reparenting (dynamically populated submenus remaining empty/disabled on OS X)
René J. V. Bertin
rjvbertin at gmail.com
Sat Sep 24 10:13:18 CEST 2016
René J.V. Bertin wrote:
Hello,
I've realised that the symptom described below is in fact a new face of the 5.4
and 5.5 Mac issue where adding QMenus, QActions and/or QActionWidgets to more
than only a native QMenuBar menu would lead to continuous error messages.
In short, it's caused by the fact that you cannot reuse a QMenu, QAction or
QActionWidget in multiple menus if one of those menus belongs to the Mac
toplevel QMenuBar. Reusing in multiple popup/context menus (right-click, under a
button, etc) or even with a non-native in-window QMenuBar seems to be perfectly
possible. For now ...
The annoying aspects of this platform limitation:
- there's (probably lots of) code "out there" which is designed to reuse menus
or simply menu items (any code based on KXMLGui::KActionCollection for instance)
- as far as I can tell it didn't exist in Qt 4.8 or Qt versions prior to 5.4
The 2nd observation leads me to believe that this is in fact an internal Qt
limitation which *could* be done away with. Are there any plans to fix this
regression?
I know this is more of a development question; I'm raising it here to see if
others have run into this limitation already. Is there already a wishlist ticket
on the bug tracker, for instance?
Thanks,
René
> Hi,
>
> I'm seeing a weird issue with two of Kate's menu items, on OS X. When the
> menubar sits at the top of the screen as is the default on OS X, 2 the
> Tools/Mode menu that selects the document content type contains only disabled
> submenus. Normally those submenus (Markup, Sources, Science etc) contain the
> known document types; they're created on the fly in the slotAboutToShow()
> method of a class (KActionMenu) inheriting QWidgetAction.
>
> What surprises me is that other comparable menus do get populated submenus.
> What surprises me even more is that the Tools/Mode menu behaves exactly as
> expected when I call
>
> QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar)
>
> early in main().
>
> This leads me to believe that the code setting up the menu either omits
> action(s), or triggers a bug in Qt (5.6.1).
>
> As usual, suggestions pointing me in the right direction appreciated!
>
> Thanks,
> René
More information about the Interest
mailing list