summaryrefslogtreecommitdiffstats
path: root/src/controls/qquickmenu_p.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-03-24 20:56:48 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-03-27 16:15:43 +0000
commitde9145dcd904068256e28e130fdfda2e8014efe8 (patch)
treefd046cf9d9d571537de633740e2b689dc9a47d47 /src/controls/qquickmenu_p.h
parentea9e620a7f5bfbac63ccc9017732bb78db8e5356 (diff)
Menu: Separate dismiss and destroy actions
This avoids issues when the action is triggered from a Menu and the slot ends up processing pending events, effectively deleting an object while one of its QML signal handlers is being executed. The reason being that we used to call deleteLater() on the menu popup window while still in the mouse event handler. Now, we do the same thing in three separate steps. 1. Close/dismiss the menu popups, 2. trigger the action, and 3. delete the popups. This keeps the menu popups and their contents alive until we return from the action triggered handler. We also need to take care of manually destroying any popup we may create. Finally, the menu content creation in Menu.qml had to be tweaked since we shouldn't rely on the popup visibility anymore. Task-number: QTBUG-45182 Change-Id: I9f1155bbf74dd3353c6c4066a24abf1cd2c3a283 Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls/qquickmenu_p.h')
-rw-r--r--src/controls/qquickmenu_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/controls/qquickmenu_p.h b/src/controls/qquickmenu_p.h
index f21f2ce0f..03e8bd431 100644
--- a/src/controls/qquickmenu_p.h
+++ b/src/controls/qquickmenu_p.h
@@ -88,6 +88,8 @@ public:
public Q_SLOTS:
void __closeMenu();
void __dismissMenu();
+ void __destroyMenuPopup();
+ void __destroyAllMenuPopups();
Q_SIGNALS:
void itemsChanged();
@@ -95,6 +97,7 @@ Q_SIGNALS:
void __selectedIndexChanged();
void __menuClosed();
+ void __menuPopupDestroyed();
void popupVisibleChanged();
void __popupGeometryChanged();
void menuContentItemChanged();
@@ -140,6 +143,7 @@ protected Q_SLOTS:
void setMenuContentItem(QQuickItem *);
void setPopupVisible(bool);
+ void clearPopupWindow();
void updateText();
void windowVisibleChanged(bool);
@@ -147,6 +151,7 @@ protected Q_SLOTS:
private:
QQuickWindow *findParentWindow();
void syncParentMenuBar();
+ QQuickMenuPopupWindow *topMenuPopup() const;
int itemIndexForListIndex(int listIndex) const;
void itemIndexToListIndex(int, int *, int *) const;