diff --git a/src/qtdesktop/Menu.qml b/src/qtdesktop/Menu.qml
index b50041b87b7886973caa166a90abff7bc147dbc5..a59cec2d8cde5752a959006fb7fb668b111630e6 100644
--- a/src/qtdesktop/Menu.qml
+++ b/src/qtdesktop/Menu.qml
@@ -187,7 +187,7 @@ MenuPrivate {
         }
 
         Keys.onLeftPressed: {
-            if (root.parent["menuItems"])
+            if (root.parentMenu)
                 closeMenu()
         }
 
diff --git a/src/qtdesktop/qtmenuitem.cpp b/src/qtdesktop/qtmenuitem.cpp
index 4ecfa44be78c666fb2827fe37434392cfe4d9507..e1e8f8c5c83715ff5a9bc88a7a9b0fe0b07335d4 100644
--- a/src/qtdesktop/qtmenuitem.cpp
+++ b/src/qtdesktop/qtmenuitem.cpp
@@ -288,6 +288,11 @@ void QtMenuItem::setAction(QtAction *a)
     emit actionChanged();
 }
 
+QtMenu *QtMenuItem::parentMenu() const
+{
+    return qobject_cast<QtMenu *>(parent());
+}
+
 QString QtMenuItem::text() const
 {
     return m_action ? m_action->text() : QString();
diff --git a/src/qtdesktop/qtmenuitem_p.h b/src/qtdesktop/qtmenuitem_p.h
index df0efb1417332ac5bfe3ddd4a9f355950735ed00..212194a0e5aca6ccc7930f78fd66d267ee1ebc7e 100644
--- a/src/qtdesktop/qtmenuitem_p.h
+++ b/src/qtdesktop/qtmenuitem_p.h
@@ -52,6 +52,7 @@ class QUrl;
 class QPlatformMenuItem;
 class QQuickItem;
 class QtAction;
+class QtMenu;
 
 class QtMenuBase: public QObject
 {
@@ -97,6 +98,7 @@ class QtMenuItem: public QtMenuBase
     Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged)
 
     Q_PROPERTY(QtAction *action READ action WRITE setAction NOTIFY actionChanged)
+    Q_PROPERTY(QtMenu *parentMenu READ parentMenu)
 
 public:
     QtMenuItem(QObject *parent = 0);
@@ -105,6 +107,8 @@ public:
     QtAction *action();
     void setAction(QtAction *a);
 
+    QtMenu *parentMenu() const;
+
     QString text() const;
     void setText(const QString &text);