diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-03-24 20:56:48 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-03-27 16:15:43 +0000 |
commit | de9145dcd904068256e28e130fdfda2e8014efe8 (patch) | |
tree | fd046cf9d9d571537de633740e2b689dc9a47d47 /src/controls/qquickmenupopupwindow_p.h | |
parent | ea9e620a7f5bfbac63ccc9017732bb78db8e5356 (diff) | |
download | qtquickcontrols-de9145dcd904068256e28e130fdfda2e8014efe8.tar.gz |
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/qquickmenupopupwindow_p.h')
-rw-r--r-- | src/controls/qquickmenupopupwindow_p.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/controls/qquickmenupopupwindow_p.h b/src/controls/qquickmenupopupwindow_p.h index 83216373..e5138073 100644 --- a/src/controls/qquickmenupopupwindow_p.h +++ b/src/controls/qquickmenupopupwindow_p.h @@ -50,10 +50,16 @@ public: void setParentItem(QQuickItem *); +public Q_SLOTS: + void setToBeDeletedLater(); + protected Q_SLOTS: void updateSize(); void updatePosition(); +Q_SIGNALS: + void willBeDeletedLater(); + protected: void exposeEvent(QExposeEvent *); |