summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoamenuitem.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-02-19 17:41:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-26 14:20:59 +0100
commitbf0336a02502b3ed4d399c1cf5b4a56b1e858d42 (patch)
tree42d86808337ad5998d75de9f1f71ceac529dca9d /src/plugins/platforms/cocoa/qcocoamenuitem.h
parent15ec9907f968f3c4ebe461617b448f5c8d05e5c5 (diff)
Cocoa Menus: Give platform menu ownership back to QWidgets
We don't want to be in the situation where a QCocoaMenuItem owns a QCocoaMenu (because that item is a submenu), and then the actual QMenu "sees" that same QCocoaMenu being deleted. Instead, since all the QCocoaMenu* classes inherit QObject, we rely on meta-object properties to set the hierarchy and climb the hierarchy when guessing the menu item's role. This ammends most of commit 370e89f06465a4d61c7b. Task-number: QTBUG-36785 Change-Id: I0e03acb593e93061c8c6c1fdd161669cf0d2a293 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenuitem.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h
index 1e69ed5a4b..b0169b9746 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h
@@ -118,6 +118,9 @@ private:
quintptr m_tag;
};
+#define COCOA_MENU_ANCESTOR(m) ((m)->property("_qCocoaMenuAncestor").value<QObject *>())
+#define SET_COCOA_MENU_ANCESTOR(m, ancestor) (m)->setProperty("_qCocoaMenuAncestor", QVariant::fromValue<QObject *>(ancestor))
+
QT_END_NAMESPACE
#endif