QCocoaMenuBar: Sync items only when they are attached to a menu
Another one of Cocoa's capricious behaviors. Evidence shows that the menu item's submenu property needs to be set before we can set the item's hidden property. We ensure this is the case by getting the NSMenuItem through QCocoaMenu::attachedItem() instead of QCocoaMenuBar::nativeItemForMenu() in QCocoaMenuBar::syncMenu(). Change-Id: Id50356dae5f556fa3d745ba9a5982e5a72bf0ac2 Task-number: QTBUG-54637 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Jason Haslam <jason@scitools.com>bb10
parent
1e843b41b6
commit
21c8a66a15
|
|
@ -173,9 +173,11 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
|
|||
}
|
||||
}
|
||||
|
||||
NSMenuItem *nativeMenuItem = nativeItemForMenu(cocoaMenu);
|
||||
nativeMenuItem.title = cocoaMenu->nsMenu().title;
|
||||
nativeMenuItem.hidden = shouldHide;
|
||||
if (NSMenuItem *attachedItem = cocoaMenu->attachedItem()) {
|
||||
// Non-nil attached item means the item's submenu is set
|
||||
attachedItem.title = cocoaMenu->nsMenu().title;
|
||||
attachedItem.hidden = shouldHide;
|
||||
}
|
||||
}
|
||||
|
||||
NSMenuItem *QCocoaMenuBar::nativeItemForMenu(QCocoaMenu *menu) const
|
||||
|
|
|
|||
Loading…
Reference in New Issue