[Interest] QML and mac system menu

Andreas Pakulat apaku at gmx.de
Tue Sep 10 22:20:16 CEST 2019


On Tue, Sep 10, 2019 at 3:26 PM Mitch Curtis <mitch.curtis at qt.io> wrote:

> > -----Original Message-----
> > From: Interest <interest-bounces at qt-project.org> On Behalf Of Alexander
> > Dyagilev
> > Sent: Tuesday, 10 September 2019 3:11 PM
> > To: interestqt-project.org <interest at qt-project.org>
> > Subject: [Interest] QML and mac system menu

> 2) Is there a way to add my custom menu items to the first menu element of
> > my app system menu (which is bold). E.g. "untitled" in my case: . "Quit"
> > menu goes there automatically despite it's in "File" menu really,
> according to
> > the QML code.
> >
> In my experience the Quit menu item goes where it wants to. It seems to be
> a feature of macOS.

I don't know for QtQuick Controls, but at least for QWidgets its not 'where
it wants to', but 'where Qt decides to put it'. There's special logic in
the native code for binding QMenu and it's items to macOS menu items that
handles actions with the (translated) text 'Quit', 'About', and 'About Qt'
and moves them to the applications' menu. So you can have a quit action in
your file menu by not calling it 'Quit' (or 'Exit'). Maybe 'Terminate'
would work.

I suspect the same logic is being applied to menus created via QtQuick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190910/4cdda241/attachment.html>

More information about the Interest mailing list