summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoamenu.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2016-03-18 13:22:19 -0700
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2016-03-22 05:56:57 +0000
commit56384a854aeaa5d3275c158c80a07082949468da (patch)
tree2eb29e4462c7ef956d22d763088d65d91b1a5a9d /src/plugins/platforms/cocoa/qcocoamenu.h
parentc228e01e1212a2ecd64d475980be04fc7b825bea (diff)
QCocoaMenus: Use mix-in pattern to implement menu hierarchy
To solve menu item roles from their text, we need to find its depth in the menubar hierarchy. Unfortunately, there's no trivial way to access that hierarchy from the QPA side, so we need to come with an ad-hoc solution. Previously, we were using a dynamic proprety to keep track of the 'parent' object. However, as the life span of the different objects has changed since 09acf326dbc6b7b67f21a36, we need a way to keep track of the parent's existence. This is what we do in this patch by having both QCocoaMenu and QCocoaMenuItem also inherit QCocoaMenuObject. This class' sole role is to store the menu hierarchy's parent object and wrap it in a QPointer. Change-Id: Ia18d95171af76d26f6325eef04c77b40d99c4285 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenu.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 5064d89585..c975de166d 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
-class QCocoaMenu : public QPlatformMenu
+class QCocoaMenu : public QPlatformMenu, public QCocoaMenuObject
{
public:
QCocoaMenu();