summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-08-18 13:32:19 +0200
committerPierre Rossi <pierre.rossi@theqtcompany.com>2015-08-18 11:47:55 +0000
commitee21737f780b5e0666c0406220fecddcf957fe82 (patch)
treea7913d86a66fc2322f5039411938e58261f1fa9b /src
parentbe00b19cf024e8406c160d044ca3a47e649398ee (diff)
Qt Quick Menu: Delay destroying the menu instance
This is necessary on Mac, where we use native menus and, in order to support catching exceptions emitted from menu handlers, we queue the 'triggered' signal emission (see qtbase commit 08cc9b9991ae9ab51). This also means that the 'done' signal is emitted before we get a chance to receive the menu item's 'triggered' signal, resulting in a noop. Change-Id: Ie5f06521fb1cdd5def1517a908078c1dd62ab0d0 Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/webengine/ui/Menu.qml11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/webengine/ui/Menu.qml b/src/webengine/ui/Menu.qml
index e6fec297f..6ecf650e8 100644
--- a/src/webengine/ui/Menu.qml
+++ b/src/webengine/ui/Menu.qml
@@ -38,8 +38,17 @@ import QtQuick 2.5
import QtQuick.Controls 1.4 as Controls
Controls.Menu {
+ id: menu
signal done()
// Use private API for now
- onAboutToHide: done();
+ onAboutToHide: doneTimer.start();
+
+ // WORKAROUND On Mac the Menu may be destroyed before the MenuItem
+ // is actually triggered (see qtbase commit 08cc9b9991ae9ab51)
+ Timer {
+ id: doneTimer
+ interval: 100
+ onTriggered: menu.done()
+ }
}