On Wednesday October 12 2016 01:12:14 Marko Käning wrote:

> > From: Albert Astals Cid <aa...@kde.org>

> > My current (yet to implement/test) idea is have 
> > KStandardAction::showMenubar check all the menubars of the top level 
> > windows of the app and if they are all marked as native, then return a 
> > dummy QAction that is not inserted in the menubar/actionCollection and that 
> > already returns "true" for checked.
> >  
> > This way the app thinks it got a real action to control the menubar status, 
> > but it is never shown to the user.
> >  
> > What do you think, do you think it could work or it is trying to be too 
> > smart and it'll break somehow?

A "long" time ago I patched a menu(bar) related issue in KDE4 apps (but 
possibly in Qt4), with some help from Thomas Luebking. I'd have to hunt down 
the patch to see exactly how this was done, but IIRC it boiled down to checking 
the parent recursively. A native Mac menubar on OS X never has a parent.

I don't disagree with the idea of hiding the menu item when it cannot work, but 
I think we'll have to ensure that the algorithm doesn't simply assume that 
certain platforms have a native menubar. IOW, the algorithm should detect at 
runtime what kind of menubar is being used.

In fact, if you look at Qt5's own code the Qt::AA_DontUseNativeMenuBar 
attribute is ON by default, and is supposed to be turned off by platform 
plugins. An application can turn the attribute back on, and on OS X there can 
be a good reason for that which is related to menu item reuse. I've evoked that 
issue often enough so I won't go into details here, but suffice it to say that 
with the current Qt5 QMenu/Bar implementation you can end up with missing or 
inactive menu items if they're  reused in the native menubar and elsewhere.
That's a very lowlevel Qt5 issue, and the only reliable way around it I've 
found to date is to disable the native menubar in applications where the 
symptoms are particularly annoying (as in my last Kate builds).

A thought that just occurs to me: one way to deal with the "hide/show menubar" 
action would be to repurpose it to allow users to use a non-native menubar 
where that's possible. It'd be a bit of a geeky feature but so is hiding the 
menubar IMHO.

BTW, it seems hat the currently the menubar is detected as being hidden on OS 
X. At least, when I fire up an application with a non-native menubar (or using 
the XCB QPA plugin), the menubar is hidden at first. A bit surprising.

R


Reply via email to