diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2016-05-02 16:49:44 -0700 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-06 19:45:59 +0000 |
commit | 939b7bfe66221975d3a12a6d0a6dd14d9ad04344 (patch) | |
tree | 41e8eb3cc9083a39ab63e2b9e254a252009a16db | |
parent | 18048cae413c8eefefc40d73dd4a7b9005e7d137 (diff) |
QCocoaMenuBar: set the native item's title
Or, "Give Cocoa a Chance to do its Magic"
Some menubar items, like the "Edit" menu, get extra items added
at some point by Cocoa. Evidence points out to those extra items
being added right after the NSMenu holding the menubar is set as
the current menubar. At that point, both the child NSMenu and its
NSMenuItem (the entry in the menubar) must have their title set.
Therefore, we must set the menubar native item's title before
QCocoaMenuBar::updateMenuBarImmediately() sets the main menu.
Task-number: QTBUG-53085
Change-Id: Idd775cf0e3485739f38363a84cfed8d2db9cb662
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Marko Kangas <marko.kangas@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenubar.mm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index ac48a0e310..a534d2064e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -173,7 +173,9 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu) } } - nativeItemForMenu(cocoaMenu).hidden = shouldHide; + NSMenuItem *nativeMenuItem = nativeItemForMenu(cocoaMenu); + nativeMenuItem.title = cocoaMenu->nsMenu().title; + nativeMenuItem.hidden = shouldHide; } NSMenuItem *QCocoaMenuBar::nativeItemForMenu(QCocoaMenu *menu) const |