diff options
Diffstat (limited to 'examples/webenginequick')
6 files changed, 184 insertions, 125 deletions
diff --git a/examples/webenginequick/nanobrowser/ApplicationRoot.qml b/examples/webenginequick/nanobrowser/ApplicationRoot.qml index f36249802..ec5716207 100644 --- a/examples/webenginequick/nanobrowser/ApplicationRoot.qml +++ b/examples/webenginequick/nanobrowser/ApplicationRoot.qml @@ -1,22 +1,24 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick import QtWebEngine QtObject { id: root - property QtObject defaultProfilePrototype : WebEngineProfilePrototype { + property WebEngineProfilePrototype defaultProfilePrototype : WebEngineProfilePrototype { storageName: "Profile" Component.onCompleted: { - let fullVersionList = defaultProfilePrototype.instance().clientHints.fullVersionList; + let fullVersionList = root.defaultProfilePrototype.instance().clientHints.fullVersionList; fullVersionList["QuickNanoBrowser"] = "1.0"; - defaultProfilePrototype.instance().clientHints.fullVersionList = fullVersionList; + root.defaultProfilePrototype.instance().clientHints.fullVersionList = fullVersionList; } } - property QtObject otrPrototype : WebEngineProfilePrototype { + property WebEngineProfilePrototype otrPrototype : WebEngineProfilePrototype { } property Component browserWindowComponent: BrowserWindow { @@ -26,18 +28,18 @@ QtObject { onClosing: destroy() } function createWindow(profile) { - var newWindow = browserWindowComponent.createObject(root); + var newWindow = browserWindowComponent.createObject(root) as BrowserWindow; newWindow.currentWebView.profile = profile; profile.downloadRequested.connect(newWindow.onDownloadRequested); return newWindow; } function createDialog(profile) { - var newDialog = browserDialogComponent.createObject(root); + var newDialog = browserDialogComponent.createObject(root) as BrowserDialog; newDialog.currentWebView.profile = profile; return newDialog; } function load(url) { - var browserWindow = createWindow(defaultProfilePrototype.instance()); + var browserWindow = createWindow(root.defaultProfilePrototype.instance()); browserWindow.currentWebView.url = url; } } diff --git a/examples/webenginequick/nanobrowser/BrowserWindow.qml b/examples/webenginequick/nanobrowser/BrowserWindow.qml index 365d77d21..474968b87 100644 --- a/examples/webenginequick/nanobrowser/BrowserWindow.qml +++ b/examples/webenginequick/nanobrowser/BrowserWindow.qml @@ -1,6 +1,8 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtCore import QtQml import QtQuick @@ -12,16 +14,17 @@ import QtWebEngine import BrowserUtils ApplicationWindow { - id: browserWindow - property QtObject applicationRoot - property Item currentWebView: tabBar.currentIndex < tabBar.count ? tabLayout.children[tabBar.currentIndex] : null + id: win + required property QtObject applicationRoot + property WebEngineView currentWebView: tabBar.currentIndex < tabBar.count ? tabLayout.children[tabBar.currentIndex] : null property int previousVisibility: Window.Windowed property int createdTabs: 0 + property bool lastTabClosing: false width: 1300 height: 900 visible: true - title: currentWebView && currentWebView.title + title: win.currentWebView?.title ?? "" // Make sure the Qt.WindowFullscreenButtonHint is set on OS X. Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint @@ -31,7 +34,7 @@ ApplicationWindow { } // When using style "mac", ToolButtons are not supposed to accept focus. - property bool platformIsMac: Qt.platform.os == "osx" + property bool platformIsMac: Qt.platform.os === "osx" Settings { id : appSettings @@ -46,6 +49,8 @@ ApplicationWindow { property alias devToolsEnabled: devToolsEnabled.checked property alias pdfViewerEnabled: pdfViewerEnabled.checked property int imageAnimationPolicy: WebEngineSettings.ImageAnimationPolicy.Allow + property alias javascriptCanAccessClipboard: javascriptCanAccessClipboard.checked + property alias javascriptCanPaste: javascriptCanPaste.checked } Action { @@ -65,14 +70,16 @@ ApplicationWindow { Action { shortcut: StandardKey.Refresh onTriggered: { - if (currentWebView) - currentWebView.reload(); + if (win.currentWebView) + win.currentWebView.reload(); } } Action { shortcut: StandardKey.AddTab onTriggered: { - tabBar.createTab(tabBar.count != 0 ? currentWebView.profile : defaultProfilePrototype.instance()); + tabBar.createTab(tabBar.count !== 0 + ? win.currentWebView.profile + : (win.applicationRoot as ApplicationRoot).defaultProfilePrototype.instance()); addressBar.forceActiveFocus(); addressBar.selectAll(); } @@ -80,20 +87,20 @@ ApplicationWindow { Action { shortcut: StandardKey.Close onTriggered: { - currentWebView.triggerWebAction(WebEngineView.RequestClose); + win.currentWebView.triggerWebAction(WebEngineView.RequestClose); } } Action { shortcut: StandardKey.Quit - onTriggered: browserWindow.close() + onTriggered: win.close() } Action { shortcut: "Escape" onTriggered: { - if (currentWebView.state == "FullScreen") { - browserWindow.visibility = browserWindow.previousVisibility; + if (win.currentWebView.state === "FullScreen") { + win.visibility = win.previousVisibility; fullScreenNotification.hide(); - currentWebView.triggerWebAction(WebEngineView.ExitFullScreen); + win.currentWebView.triggerWebAction(WebEngineView.ExitFullScreen); } if (findBar.visible) @@ -102,52 +109,52 @@ ApplicationWindow { } Action { shortcut: "Ctrl+0" - onTriggered: currentWebView.zoomFactor = 1.0 + onTriggered: win.currentWebView.zoomFactor = 1.0 } Action { shortcut: StandardKey.ZoomOut - onTriggered: currentWebView.zoomFactor -= 0.1 + onTriggered: win.currentWebView.zoomFactor -= 0.1 } Action { shortcut: StandardKey.ZoomIn - onTriggered: currentWebView.zoomFactor += 0.1 + onTriggered: win.currentWebView.zoomFactor += 0.1 } Action { shortcut: StandardKey.Copy - onTriggered: currentWebView.triggerWebAction(WebEngineView.Copy) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Copy) } Action { shortcut: StandardKey.Cut - onTriggered: currentWebView.triggerWebAction(WebEngineView.Cut) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Cut) } Action { shortcut: StandardKey.Paste - onTriggered: currentWebView.triggerWebAction(WebEngineView.Paste) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Paste) } Action { shortcut: "Shift+"+StandardKey.Paste - onTriggered: currentWebView.triggerWebAction(WebEngineView.PasteAndMatchStyle) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.PasteAndMatchStyle) } Action { shortcut: StandardKey.SelectAll - onTriggered: currentWebView.triggerWebAction(WebEngineView.SelectAll) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.SelectAll) } Action { shortcut: StandardKey.Undo - onTriggered: currentWebView.triggerWebAction(WebEngineView.Undo) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Undo) } Action { shortcut: StandardKey.Redo - onTriggered: currentWebView.triggerWebAction(WebEngineView.Redo) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Redo) } Action { shortcut: StandardKey.Back - onTriggered: currentWebView.triggerWebAction(WebEngineView.Back) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Back) } Action { shortcut: StandardKey.Forward - onTriggered: currentWebView.triggerWebAction(WebEngineView.Forward) + onTriggered: win.currentWebView.triggerWebAction(WebEngineView.Forward) } Action { shortcut: StandardKey.Find @@ -170,16 +177,17 @@ ApplicationWindow { RowLayout { anchors.fill: parent ToolButton { - enabled: currentWebView && (currentWebView.canGoBack || currentWebView.canGoForward) + enabled: win.currentWebView?.canGoBack || win.currentWebView?.canGoForward onClicked: historyMenu.open() text: qsTr("âŧ") Menu { id: historyMenu Instantiator { - model: currentWebView && currentWebView.history.items + model: win.currentWebView?.history?.items MenuItem { + required property var model text: model.title - onTriggered: currentWebView.goBackOrForward(model.offset) + onTriggered: win.currentWebView.goBackOrForward(model.offset) checkable: !enabled checked: !enabled enabled: model.offset @@ -197,23 +205,25 @@ ApplicationWindow { ToolButton { id: backButton - icon.source: "qrc:/icons/go-previous.png" - onClicked: currentWebView.goBack() - enabled: currentWebView && currentWebView.canGoBack - activeFocusOnTab: !browserWindow.platformIsMac + icon.source: "icons/3rdparty/go-previous.png" + onClicked: win.currentWebView.goBack() + enabled: win.currentWebView?.canGoBack ?? false + activeFocusOnTab: !win.platformIsMac } ToolButton { id: forwardButton - icon.source: "qrc:/icons/go-next.png" - onClicked: currentWebView.goForward() - enabled: currentWebView && currentWebView.canGoForward - activeFocusOnTab: !browserWindow.platformIsMac + icon.source: "icons/3rdparty/go-next.png" + onClicked: win.currentWebView.goForward() + enabled: win.currentWebView?.canGoForward ?? false + activeFocusOnTab: !win.platformIsMac } ToolButton { id: reloadButton - icon.source: currentWebView && currentWebView.loading ? "qrc:/icons/process-stop.png" : "qrc:/icons/view-refresh.png" - onClicked: currentWebView && currentWebView.loading ? currentWebView.stop() : currentWebView.reload() - activeFocusOnTab: !browserWindow.platformIsMac + icon.source: win.currentWebView?.loading + ? "icons/3rdparty/process-stop.png" + : "icons/3rdparty/view-refresh.png" + onClicked: win.currentWebView?.loading ? win.currentWebView.stop() : win.currentWebView.reload() + activeFocusOnTab: !win.platformIsMac } TextField { id: addressBar @@ -224,7 +234,7 @@ ApplicationWindow { id: faviconImage width: 16; height: 16 sourceSize: Qt.size(width, height) - source: currentWebView && currentWebView.icon ? currentWebView.icon : '' + source: win.currentWebView?.icon ? win.currentWebView.icon : '' } MouseArea { id: textFieldMouseArea @@ -272,10 +282,10 @@ ApplicationWindow { focus: true Layout.fillWidth: true Binding on text { - when: currentWebView - value: currentWebView.url + when: win.currentWebView + value: win.currentWebView.url } - onAccepted: currentWebView.url = Utils.fromUserInput(text) + onAccepted: win.currentWebView.url = Utils.fromUserInput(text) selectByMouse: true } ToolButton { @@ -319,21 +329,25 @@ ApplicationWindow { id: offTheRecordEnabled text: "Off The Record" checkable: true - checked: currentWebView && currentWebView.profile === otrPrototype.instance() - onToggled: function(checked) { - if (currentWebView) { - currentWebView.profile = checked ? otrPrototype.instance() : defaultProfilePrototype.instance(); + checked: win.currentWebView?.profile === (win.applicationRoot as ApplicationRoot).otrPrototype.instance() + onToggled: function() { + if (win.currentWebView) { + win.currentWebView.profile = offTheRecordEnabled.checked + ? (win.applicationRoot as ApplicationRoot).otrPrototype.instance() + : (win.applicationRoot as ApplicationRoot).defaultProfilePrototype.instance(); } } } MenuItem { id: httpDiskCacheEnabled text: "HTTP Disk Cache" - checkable: currentWebView && !currentWebView.profile.offTheRecord - checked: currentWebView && (currentWebView.profile.httpCacheType === WebEngineProfile.DiskHttpCache) - onToggled: function(checked) { - if (currentWebView) { - currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache; + checkable: !win.currentWebView?.profile?.offTheRecord ?? false + checked: win.currentWebView?.profile.httpCacheType === WebEngineProfile.DiskHttpCache + onToggled: function() { + if (win.currentWebView) { + win.currentWebView.profile.httpCacheType = httpDiskCacheEnabled.checked + ? WebEngineProfile.DiskHttpCache + : WebEngineProfile.MemoryHttpCache; } } } @@ -368,7 +382,6 @@ ApplicationWindow { checkable: true checked: WebEngine.settings.pdfViewerEnabled } - Menu { id: imageAnimationPolicy title: "Image Animation Policy" @@ -407,6 +420,18 @@ ApplicationWindow { } } + MenuItem { + id: javascriptCanAccessClipboard + text: "JavaScript can access clipboard" + checkable: true + checked: WebEngine.settings.javascriptCanAccessClipboard + } + MenuItem { + id: javascriptCanPaste + text: "JavaScript can paste" + checkable: true + checked: WebEngine.settings.javascriptCanPaste + } } } } @@ -417,14 +442,14 @@ ApplicationWindow { left: parent.left top: parent.bottom right: parent.right - leftMargin: parent.leftMargin - rightMargin: parent.rightMargin + leftMargin: parent.anchors.leftMargin + rightMargin: parent.anchors.rightMargin } background: Item {} z: -2 from: 0 to: 100 - value: (currentWebView && currentWebView.loadProgress < 100) ? currentWebView.loadProgress : 0 + value: (win.currentWebView?.loadProgress < 100) ? win.currentWebView.loadProgress : 0 } } @@ -442,22 +467,22 @@ ApplicationWindow { id: tabButtonComponent TabButton { - property color frameColor: "#999" - property color fillColor: "#eee" - property color nonSelectedColor: "#ddd" + id: tabButton + property color frameColor: "#999999" + property color fillColor: "#eeeeee" + property color nonSelectedColor: "#dddddd" property string tabTitle: "New Tab" - id: tabButton contentItem: Rectangle { id: tabRectangle - color: tabButton.down ? fillColor : nonSelectedColor + color: tabButton.down ? tabButton.fillColor : tabButton.nonSelectedColor border.width: 1 - border.color: frameColor + border.color: tabButton.frameColor implicitWidth: Math.max(text.width + 30, 80) implicitHeight: Math.max(text.height + 10, 20) - Rectangle { height: 1 ; width: parent.width ; color: frameColor} - Rectangle { height: parent.height ; width: 1; color: frameColor} - Rectangle { x: parent.width - 2; height: parent.height ; width: 1; color: frameColor} + Rectangle { height: 1 ; width: parent.width ; color: tabButton.frameColor} + Rectangle { height: parent.height ; width: 1; color: tabButton.frameColor} + Rectangle { x: parent.width - 2; height: parent.height ; width: 1; color: tabButton.frameColor} Text { id: text anchors.left: parent.left @@ -465,7 +490,7 @@ ApplicationWindow { anchors.leftMargin: 6 text: tabButton.tabTitle elide: Text.ElideRight - color: tabButton.down ? "black" : frameColor + color: tabButton.down ? "black" : tabButton.frameColor width: parent.width - button.background.width } Button { @@ -477,16 +502,16 @@ ApplicationWindow { background: Rectangle { implicitWidth: 12 implicitHeight: 12 - color: button.hovered ? "#ccc" : tabRectangle.color + color: button.hovered ? "#cccccc" : tabRectangle.color Text {text: "x"; anchors.centerIn: parent; color: "gray"} } onClicked: tabButton.closeTab() } } - onClicked: addressBar.text = tabLayout.itemAt(TabBar.index).url; + onClicked: addressBar.text = (tabLayout.itemAt(TabBar.index) as WebEngineView).url; function closeTab() { - tabBar.removeView(TabBar.index); + tabBar.tryCloseView(TabBar.index); } } } @@ -496,10 +521,10 @@ ApplicationWindow { anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - Component.onCompleted: createTab(defaultProfilePrototype.instance()) + Component.onCompleted: createTab((win.applicationRoot as ApplicationRoot).defaultProfilePrototype.instance()) function createTab(profile, focusOnNewTab = true, url = undefined) { - var webview = tabComponent.createObject(tabLayout, {profile: profile}); + var webview = tabComponent.createObject(tabLayout, {index: tabBar.count , profile: profile}); var newTabButton = tabButtonComponent.createObject(tabBar, {tabTitle: Qt.binding(function () { return webview.title; })}); tabBar.addItem(newTabButton); if (focusOnNewTab) { @@ -511,12 +536,17 @@ ApplicationWindow { return webview; } + function tryCloseView(index) { + tabLayout.children[index].triggerWebAction(WebEngineView.RequestClose); + } + function removeView(index) { if (tabBar.count > 1) { tabBar.removeItem(tabBar.itemAt(index)); tabLayout.children[index].destroy(); } else { - browserWindow.close(); + win.lastTabClosing = true; + win.close(); } } @@ -524,10 +554,11 @@ ApplicationWindow { id: tabComponent WebEngineView { id: webEngineView + property int index; focus: true onLinkHovered: function(hoveredUrl) { - if (hoveredUrl == "") + if (hoveredUrl === "") hideStatusText.start(); else { statusText.text = hoveredUrl; @@ -563,6 +594,12 @@ ApplicationWindow { settings.pdfViewerEnabled: appSettings.pdfViewerEnabled settings.imageAnimationPolicy: appSettings.imageAnimationPolicy settings.screenCaptureEnabled: true + settings.javascriptCanAccessClipboard: appSettings.javascriptCanAccessClipboard + settings.javascriptCanPaste: appSettings.javascriptCanPaste + + onWindowCloseRequested: function() { + tabBar.removeView(webEngineView.index); + } onCertificateError: function(error) { if (!error.isMainFrame) { @@ -578,29 +615,29 @@ ApplicationWindow { if (!request.userInitiated) console.warn("Blocked a popup window."); else if (request.destination === WebEngineNewWindowRequest.InNewTab) { - var tab = tabBar.createTab(currentWebView.profile, true, request.requestedUrl); + var tab = tabBar.createTab(win.currentWebView.profile, true, request.requestedUrl); tab.acceptAsNewWindow(request); } else if (request.destination === WebEngineNewWindowRequest.InNewBackgroundTab) { - var backgroundTab = tabBar.createTab(currentWebView.profile, false); + var backgroundTab = tabBar.createTab(win.currentWebView.profile, false); backgroundTab.acceptAsNewWindow(request); } else if (request.destination === WebEngineNewWindowRequest.InNewDialog) { - var dialog = applicationRoot.createDialog(currentWebView.profile); - dialog.currentWebView.acceptAsNewWindow(request); + var dialog = (win.applicationRoot as ApplicationRoot).createDialog(win.currentWebView.profile); + dialog.win.currentWebView.acceptAsNewWindow(request); } else { - var window = applicationRoot.createWindow(currentWebView.profile); - window.currentWebView.acceptAsNewWindow(request); + var window = (win.applicationRoot as ApplicationRoot).createWindow(win.currentWebView.profile); + window.win.currentWebView.acceptAsNewWindow(request); } } onFullScreenRequested: function(request) { if (request.toggleOn) { webEngineView.state = "FullScreen"; - browserWindow.previousVisibility = browserWindow.visibility; - browserWindow.showFullScreen(); + win.previousVisibility = win.visibility; + win.showFullScreen(); fullScreenNotification.show(); } else { webEngineView.state = ""; - browserWindow.visibility = browserWindow.previousVisibility; + win.visibility = win.previousVisibility; fullScreenNotification.hide(); } request.accept(); @@ -651,7 +688,7 @@ ApplicationWindow { } onLoadingChanged: function(loadRequest) { - if (loadRequest.status == WebEngineView.LoadStartedStatus) + if (loadRequest.status === WebEngineView.LoadStartedStatus) findBar.reset(); } @@ -668,7 +705,7 @@ ApplicationWindow { interval: 0 running: false repeat: false - onTriggered: currentWebView.reload() + onTriggered: win.currentWebView.reload() } } } @@ -682,7 +719,7 @@ ApplicationWindow { anchors.right: parent.right anchors.bottom: parent.bottom onNewWindowRequested: function(request) { - var tab = tabBar.createTab(currentWebView.profile); + var tab = tabBar.createTab(win.currentWebView.profile); request.openIn(tab); } @@ -693,7 +730,7 @@ ApplicationWindow { repeat: false onTriggered: devToolsEnabled.checked = false } - onWindowCloseRequested: function(request) { + onWindowCloseRequested: function() { // Delay hiding for keep the inspectedView set to receive the ACK message of close. hideTimer.running = true; } @@ -744,7 +781,7 @@ ApplicationWindow { Dialog { id: permissionDialog anchors.centerIn: parent - width: Math.min(browserWindow.width, browserWindow.height) / 3 * 2 + width: Math.min(win.width, win.height) / 3 * 2 contentWidth: mainTextForPermissionDialog.width contentHeight: mainTextForPermissionDialog.height standardButtons: Dialog.No | Dialog.Yes @@ -859,13 +896,13 @@ ApplicationWindow { onFindNext: { if (text) - currentWebView && currentWebView.findText(text); + win.currentWebView?.findText(text); else if (!visible) visible = true; } onFindPrevious: { if (text) - currentWebView && currentWebView.findText(text, WebEngineView.FindBackward); + win.currentWebView?.findText(text, WebEngineView.FindBackward); else if (!visible) visible = true; } @@ -898,4 +935,14 @@ ApplicationWindow { } } } + + onClosing: function(closeEvent) { + if (lastTabClosing) { + return; + } + closeEvent.accepted = false + for (var i = 0; i < tabBar.count; i++) { + tabBar.tryCloseView(i); + } + } } diff --git a/examples/webenginequick/nanobrowser/DownloadView.qml b/examples/webenginequick/nanobrowser/DownloadView.qml index b116ab867..ef0c7f5a7 100644 --- a/examples/webenginequick/nanobrowser/DownloadView.qml +++ b/examples/webenginequick/nanobrowser/DownloadView.qml @@ -1,10 +1,10 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Controls.Fusion -import QtWebEngine -import QtQuick.Layouts Rectangle { id: downloadView @@ -25,20 +25,26 @@ Rectangle { id: downloadItemDelegate Rectangle { + id: downloadItem width: listView.width height: childrenRect.height anchors.margins: 10 radius: 3 color: "transparent" border.color: "black" + + required property int index + Rectangle { id: progressBar - property real progress: downloadModel.downloads[index] - ? downloadModel.downloads[index].receivedBytes / downloadModel.downloads[index].totalBytes : 0 + property real progress: { + let d = downloadModel.downloads[downloadItem.index] + return d ? d.receivedBytes / d.totalBytes : 0 + } radius: 3 - color: width == listView.width ? "green" : "#2b74c7" + color: width === listView.width ? "green" : "#2b74c7" width: listView.width * progress height: cancelButton.height @@ -54,7 +60,10 @@ Rectangle { } Label { id: label - text: downloadModel.downloads[index] ? downloadModel.downloads[index].downloadDirectory + "/" + downloadModel.downloads[index].downloadFileName : qsTr("") + text: { + let d = downloadModel.downloads[downloadItem.index] + return d ? d.downloadDirectory + "/" + d.downloadFileName : qsTr("") + } anchors { verticalCenter: cancelButton.verticalCenter left: parent.left @@ -64,16 +73,16 @@ Rectangle { Button { id: cancelButton anchors.right: parent.right - icon.source: "qrc:/icons/process-stop.png" + icon.source: "icons/3rdparty/process-stop.png" onClicked: { - var download = downloadModel.downloads[index]; + var download = downloadModel.downloads[downloadItem.index]; download.cancel(); downloadModel.downloads = downloadModel.downloads.filter(function (el) { return el.id !== download.id; }); - downloadModel.remove(index); + downloadModel.remove(downloadItem.index); } } } diff --git a/examples/webenginequick/nanobrowser/FindBar.qml b/examples/webenginequick/nanobrowser/FindBar.qml index 409d8dcff..013f28e88 100644 --- a/examples/webenginequick/nanobrowser/FindBar.qml +++ b/examples/webenginequick/nanobrowser/FindBar.qml @@ -63,46 +63,47 @@ Rectangle { } Label { - text: activeMatch + "/" + numberOfMatches - visible: findTextField.text != "" + text: root.activeMatch + "/" + root.numberOfMatches + visible: findTextField.text !== "" color: "black" } Rectangle { border.width: 1 - border.color: "#ddd" - width: 2 - height: parent.height - anchors.topMargin: 5 - anchors.bottomMargin: 5 + border.color: "#dddddd" + Layout.preferredWidth: 2 + Layout.preferredHeight: parent.height } ToolButton { + id: findBtnLeft text: "<" - enabled: numberOfMatches > 0 + enabled: root.numberOfMatches > 0 onClicked: root.findPrevious() contentItem: Text { color: "black" - text: parent.text + text: findBtnLeft.text } } ToolButton { + id: findBtnRight text: ">" - enabled: numberOfMatches > 0 + enabled: root.numberOfMatches > 0 onClicked: root.findNext() contentItem: Text { color: "black" - text: parent.text + text: findBtnRight.text } } ToolButton { + id: findBtnClose text: "x" onClicked: root.visible = false contentItem: Text { color: "black" - text: parent.text + text: findBtnClose.text } } } diff --git a/examples/webenginequick/nanobrowser/FullScreenNotification.qml b/examples/webenginequick/nanobrowser/FullScreenNotification.qml index 779406432..cdf154c78 100644 --- a/examples/webenginequick/nanobrowser/FullScreenNotification.qml +++ b/examples/webenginequick/nanobrowser/FullScreenNotification.qml @@ -28,8 +28,8 @@ Rectangle { NumberAnimation { duration: 750 onStopped: { - if (opacity == 0) - visible = false; + if (fullScreenNotification.opacity === 0) + fullScreenNotification.visible = false; } } } @@ -37,7 +37,7 @@ Rectangle { Timer { id: reset interval: 5000 - onTriggered: hide() + onTriggered: fullScreenNotification.hide() } anchors.horizontalCenter: parent.horizontalCenter diff --git a/examples/webenginequick/nanobrowser/rc_resources.py b/examples/webenginequick/nanobrowser/rc_resources.py index 990f10274..b517c39a0 100644 --- a/examples/webenginequick/nanobrowser/rc_resources.py +++ b/examples/webenginequick/nanobrowser/rc_resources.py @@ -1,6 +1,6 @@ # Resource object code (Python 3) # Created by: object code -# Created by: The Resource Compiler for Qt version 6.4.0 +# Created by: The Resource Compiler for Qt version 6.10.0 # WARNING! All changes made in this file will be lost! from PySide6 import QtCore @@ -330,13 +330,13 @@ qt_resource_struct = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00,\x00\x00\x00\x00\x00\x01\x00\x00\x03\xa6\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ \x00\x00\x00R\x00\x00\x00\x00\x00\x01\x00\x00\x08\xfe\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ \x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ \x00\x00\x00x\x00\x00\x00\x00\x00\x01\x00\x00\x0d\xfa\ -\x00\x00\x01{\xe0\xa8\xe4\xe2\ +\x00\x00\x01\x975l\xc7\xfb\ " def qInitResources(): |