From 2e9c6cd0bd6789a4f46fe0bcfbd522f0dd3eb4cb Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 9 Oct 2015 10:50:56 +0200 Subject: add RequestClose web action Web pages can set the onbeforeunload handler to let the user confirm whether to leave the page or not. Until now, only when leaving the page via a link, a confirmation was shown. Before actually closing a web page, applications can now trigger the RequestClose web action. This will give the use the chance to confirm or deny the close request. If the request is confirmed, the signal windowCloseRequested is emitted. Task-number: QTBUG-36155 Change-Id: Icc1fabc37a2ac537f674c2f00bc8966e4dc4e610 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/quick/qmltests/data/TestWebEngineView.qml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto/quick/qmltests/data/TestWebEngineView.qml') diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml index 8a01dfa09..e2c5c9009 100644 --- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml +++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml @@ -47,6 +47,7 @@ import QtWebEngine.experimental 1.0 WebEngineView { property var loadStatus: null property var viewportReady: false + property bool windowCloseRequestedSignalEmitted: false function waitForLoadSucceeded() { var success = _waitFor(function() { return loadStatus == WebEngineView.LoadSucceededStatus }) @@ -69,6 +70,9 @@ WebEngineView { loadStatus = null return stop } + function waitForWindowCloseRequested() { + return _waitFor(function() { return windowCloseRequestedSignalEmitted; }); + } function _waitFor(predicate) { var timeout = 5000 var i = 0 @@ -87,5 +91,8 @@ WebEngineView { viewportReady = false } + onWindowCloseRequested: { + windowCloseRequestedSignalEmitted = true; + } } -- cgit v1.2.3