summaryrefslogtreecommitdiff
path: root/examples/webengine/quicknanobrowser/BrowserWindow.qml
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-09-12 10:00:03 +0200
committerLiang Qi <liang.qi@qt.io>2019-09-12 20:19:28 +0200
commit2f71cdff2cda7903fd0b5ff0033d790877e40181 (patch)
tree0255e40f5366123bedefcbc9ad7d482f2e8198a2 /examples/webengine/quicknanobrowser/BrowserWindow.qml
parentd91b839d67bcfa1cfeb3d095b6885c97c53b9812 (diff)
parent5b0bbd7345b698faab0116b821802fb4a30c0fa4 (diff)
downloadqtwebengine-wip/qt6.tar.gz
Merge "Merge remote-tracking branch 'origin/5.14' into wip/qt6"wip/qt6
Diffstat (limited to 'examples/webengine/quicknanobrowser/BrowserWindow.qml')
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml59
1 files changed, 58 insertions, 1 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index 088b23e59..39a13df59 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -57,7 +57,7 @@ import QtQuick.Controls.Styles 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.0
import QtQuick.Window 2.1
-import QtWebEngine 1.10
+import QtWebEngine 1.11
ApplicationWindow {
id: browserWindow
@@ -73,6 +73,10 @@ ApplicationWindow {
// Make sure the Qt.WindowFullscreenButtonHint is set on OS X.
Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
+ onCurrentWebViewChanged: {
+ findBar.reset();
+ }
+
// Create a styleItem to determine the platform.
// When using style "mac", ToolButtons are not supposed to accept focus.
QQCPrivate.StyleItem { id: styleItem }
@@ -136,6 +140,9 @@ ApplicationWindow {
fullScreenNotification.hide();
currentWebView.triggerWebAction(WebEngineView.ExitFullScreen);
}
+
+ if (findBar.visible)
+ findBar.visible = false;
}
}
Action {
@@ -187,6 +194,21 @@ ApplicationWindow {
shortcut: StandardKey.Forward
onTriggered: currentWebView.triggerWebAction(WebEngineView.Forward)
}
+ Action {
+ shortcut: StandardKey.Find
+ onTriggered: {
+ if (!findBar.visible)
+ findBar.visible = true;
+ }
+ }
+ Action {
+ shortcut: StandardKey.FindNext
+ onTriggered: findBar.findNext()
+ }
+ Action {
+ shortcut: StandardKey.FindPrevious
+ onTriggered: findBar.findPrevious()
+ }
toolBar: ToolBar {
id: navigationBar
@@ -553,6 +575,19 @@ ApplicationWindow {
selection.certificates[0].select();
}
+ onFindTextFinished: function(result) {
+ if (!findBar.visible)
+ findBar.visible = true;
+
+ findBar.numberOfMatches = result.numberOfMatches;
+ findBar.activeMatchOrdinal = result.activeMatchOrdinal;
+ }
+
+ onLoadingChanged: function(loadRequest) {
+ if (loadRequest.status == WebEngineView.LoadStartedStatus)
+ findBar.reset();
+ }
+
Timer {
id: reloadTimer
interval: 0
@@ -625,6 +660,28 @@ ApplicationWindow {
download.accept();
}
+ FindBar {
+ id: findBar
+ visible: false
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ anchors.top: parent.top
+
+ onFindNext: {
+ if (text)
+ currentWebView && currentWebView.findText(text);
+ else if (!visible)
+ visible = true;
+ }
+ onFindPrevious: {
+ if (text)
+ currentWebView && currentWebView.findText(text, WebEngineView.FindBackward);
+ else if (!visible)
+ visible = true;
+ }
+ }
+
+
Rectangle {
id: statusBubble
color: "oldlace"