QCocoaMenu: Have the menu delegate return the right amount of items
In some cases we move menu items around, therefore we should not rely on QCocoaMenu::items() being the actual items inside the menu. But, since the NSMenu is updated before hand, we can rely on NSMenu.numberOfItems instead. Change-Id: Icd4497beca4f52a6d38408eeaa2e6ec71b579685 Task-number: QTBUG-52931 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
2e9fc0d3f0
commit
6844f60dae
@ -99,7 +99,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate);
|
||||
- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
|
||||
{
|
||||
Q_ASSERT(m_menu->nsMenu() == menu);
|
||||
return m_menu->items().count();
|
||||
return menu.numberOfItems;
|
||||
}
|
||||
|
||||
- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel
|
||||
|
Loading…
x
Reference in New Issue
Block a user