diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2016-04-22 11:52:29 -0700 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-04-27 06:07:59 +0000 |
commit | 6844f60dae50dcbec9b016531c21a904fe965b9c (patch) | |
tree | ea7598007a57c9c361ceb1679183112f1c7a8308 /src/plugins/platforms/cocoa/qcocoamenu.mm | |
parent | 2e9fc0d3f06c41f0a3d6c68d321ea56a761b25bf (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenu.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenu.mm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 6ed7aa0e06..878c96d33a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -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 |