summaryrefslogtreecommitdiffstats
path: root/examples/webengine/quicknanobrowser/BrowserWindow.qml
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2014-12-01 04:34:04 -0800
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2015-01-23 12:10:54 +0100
commitfb612f3d2b181742730e18ca15c0944af0b743c5 (patch)
tree4706e39aca1d3e9908fba20c90a30dfffe3a4772 /examples/webengine/quicknanobrowser/BrowserWindow.qml
parenta9cae7c25c67dfc21f63202a9fadba8ad20d24df (diff)
Move newViewRequested to the public API
This moves the API to public, with proper versioning, adds documentation and adjust the warning to also report an null parameter to openIn that would cause the load to fail. The experimental example code is copied from quicktestbrowser to quicknanobrowser. Change-Id: I23b06c7a5add0323d0540a783873584438d85ea8 Reviewed-by: Szabolcs David <davidsz@inf.u-szeged.hu> Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'examples/webengine/quicknanobrowser/BrowserWindow.qml')
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml18
1 files changed, 16 insertions, 2 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index b954629fb..8d9980746 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.1
-import QtWebEngine 1.0
+import QtWebEngine 1.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0
@@ -48,7 +48,7 @@ import QtQuick.Controls.Private 1.0
ApplicationWindow {
id: browserWindow
- function load(url) { currentWebView.url = url }
+ property QtObject applicationRoot
property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item : null
width: 1300
@@ -198,6 +198,20 @@ ApplicationWindow {
statusText.text = hoveredUrl
}
}
+ onNewViewRequested: {
+ if (!request.userInitiated)
+ print("Warning: Blocked a popup window.")
+ else if (request.destination == WebEngineView.NewViewInTab) {
+ var tab = tabs.createEmptyTab()
+ request.openIn(tab.item)
+ } else if (request.destination == WebEngineView.NewViewInDialog) {
+ var dialog = applicationRoot.createDialog()
+ request.openIn(dialog.currentWebView)
+ } else {
+ var window = applicationRoot.createWindow()
+ request.openIn(window.currentWebView)
+ }
+ }
}
}
}