diff options
author | Andy Shaw <andy.shaw@qt.io> | 2017-09-07 00:50:08 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2017-09-08 17:45:54 +0000 |
commit | 689606de91faecf91f1f92e8d355789d9be62d2f (patch) | |
tree | a63654d7a900e44e55c28223a677fca7d1f78470 /src/plugins/platforms/cocoa/qcocoamenubar.mm | |
parent | 452ad2bb1358ad5206440457fecbac92779dc680 (diff) | |
download | qtbase-689606de91faecf91f1f92e8d355789d9be62d2f.tar.gz |
Cocoa: Update the known menu items when the QCocoaMenuBar is deleted
If an application has more than one menubar, for instance, one for each
mainwindow it has visible then once one is deleted it needs to ensure
the application menu items are updated as appropriate.
To do this the resetting of the known menu items is extended to cover
all the application specific ones so that they can all be updated
correctly.
Task-number: QTBUG-62193
Change-Id: I61f46a4745f4e40b9283d40fa5a7473f2721c354
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenubar.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenubar.mm | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 70fcb40774..3e466c9587 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -86,6 +86,7 @@ QCocoaMenuBar::~QCocoaMenuBar() // the menu bar was updated qDeleteAll(children()); updateMenuBarImmediately(); + resetKnownMenuItemsToQt(); } } @@ -306,16 +307,9 @@ void QCocoaMenuBar::resetKnownMenuItemsToQt() foreach (QCocoaMenuBar *mb, static_menubars) { foreach (QCocoaMenu *m, mb->m_menus) { foreach (QCocoaMenuItem *i, m->items()) { - switch (i->effectiveRole()) { - case QPlatformMenuItem::CutRole: - case QPlatformMenuItem::CopyRole: - case QPlatformMenuItem::PasteRole: - case QPlatformMenuItem::SelectAllRole: + if (i->effectiveRole() >= QPlatformMenuItem::ApplicationSpecificRole) { [i->nsItem() setTarget:m->nsMenu().delegate]; [i->nsItem() setAction:@selector(itemFired:)]; - break; - default: - break; } } } |