diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-05 14:22:45 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-05 14:22:45 +0200 |
commit | f2856875843efce9a00e90dad05bde358ab82197 (patch) | |
tree | 93346c38504ce04f0bf02dfe4a21299feb1be8ed /src/plugins/platforms/cocoa/qcocoamenuitem.mm | |
parent | a7b04275082d065f392e7f18c54ea9b41507ae40 (diff) | |
parent | a2970719c26c946fd6fea7d902aad6706a4ca6ea (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
examples/corelib/ipc/ipc.pro
src/plugins/platforms/xcb/qxcbbackingstore.cpp
tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenuitem.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuitem.mm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index de0271ce4d..fa54c1e90e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -113,8 +113,8 @@ QCocoaMenuItem::~QCocoaMenuItem() { QMacAutoReleasePool pool; - if (m_menu && COCOA_MENU_ANCESTOR(m_menu) == this) - SET_COCOA_MENU_ANCESTOR(m_menu, 0); + if (m_menu && m_menu->menuParent() == this) + m_menu->setMenuParent(0); if (m_merged) { [m_native setHidden:YES]; } else { @@ -140,14 +140,14 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu) return; if (m_menu) { - if (COCOA_MENU_ANCESTOR(m_menu) == this) - SET_COCOA_MENU_ANCESTOR(m_menu, 0); + if (m_menu->menuParent() == this) + m_menu->setMenuParent(0); } QMacAutoReleasePool pool; m_menu = static_cast<QCocoaMenu *>(menu); if (m_menu) { - SET_COCOA_MENU_ANCESTOR(m_menu, this); + m_menu->setMenuParent(this); } else { // we previously had a menu, but no longer // clear out our item so the nexy sync() call builds a new one @@ -237,12 +237,14 @@ NSMenuItem *QCocoaMenuItem::sync() mergeItem = [loader preferencesMenuItem]; break; case TextHeuristicRole: { - QObject *p = COCOA_MENU_ANCESTOR(this); + QObject *p = menuParent(); int depth = 1; QCocoaMenuBar *menubar = 0; while (depth < 3 && p && !(menubar = qobject_cast<QCocoaMenuBar *>(p))) { ++depth; - p = COCOA_MENU_ANCESTOR(p); + QCocoaMenuObject *menuObject = dynamic_cast<QCocoaMenuObject *>(p); + Q_ASSERT(menuObject); + p = menuObject->menuParent(); } if (depth == 3 || !menubar) break; // Menu item too deep in the hierarchy, or not connected to any menubar |