diff options
Diffstat (limited to 'examples/webengine')
-rw-r--r-- | examples/webengine/customdialogs/doc/src/customdialogs.qdoc | 9 | ||||
-rw-r--r-- | examples/webengine/lifecycle/WebTab.qml | 2 | ||||
-rw-r--r-- | examples/webengine/lifecycle/WebTabButton.qml | 2 | ||||
-rw-r--r-- | examples/webengine/lifecycle/main.cpp | 2 | ||||
-rw-r--r-- | examples/webengine/quicknanobrowser/BrowserWindow.qml | 31 |
5 files changed, 29 insertions, 17 deletions
diff --git a/examples/webengine/customdialogs/doc/src/customdialogs.qdoc b/examples/webengine/customdialogs/doc/src/customdialogs.qdoc index 6319ce53b..16eab0b6c 100644 --- a/examples/webengine/customdialogs/doc/src/customdialogs.qdoc +++ b/examples/webengine/customdialogs/doc/src/customdialogs.qdoc @@ -57,11 +57,10 @@ \section1 Triggering Dialogs - As mentioned, the \l {webengine/customdialogs/index.html}{index.html} file - is responsible for triggering the dialogs from the side of HTML and - JavaScript. Additionally, the example program starts a localhost TCP server - returning the mocked HTTP responses needed to trigger proxy and HTTP - authentication dialogs. + As mentioned, the \c index.html file is responsible for triggering the + dialogs from the side of HTML and JavaScript. Additionally, the example + program starts a localhost TCP server returning the mocked HTTP responses + needed to trigger proxy and HTTP authentication dialogs. \section1 Custom Dialogs diff --git a/examples/webengine/lifecycle/WebTab.qml b/examples/webengine/lifecycle/WebTab.qml index 645758104..8649da3cb 100644 --- a/examples/webengine/lifecycle/WebTab.qml +++ b/examples/webengine/lifecycle/WebTab.qml @@ -53,7 +53,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Layouts 1.12 -import QtWebEngine 1.11 +import QtWebEngine 1.10 ColumnLayout { id: root diff --git a/examples/webengine/lifecycle/WebTabButton.qml b/examples/webengine/lifecycle/WebTabButton.qml index 815e2fb09..68057412b 100644 --- a/examples/webengine/lifecycle/WebTabButton.qml +++ b/examples/webengine/lifecycle/WebTabButton.qml @@ -52,7 +52,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Layouts 1.12 -import QtWebEngine 1.11 +import QtWebEngine 1.10 TabButton { id: root diff --git a/examples/webengine/lifecycle/main.cpp b/examples/webengine/lifecycle/main.cpp index 83907cbaf..bb93d64a7 100644 --- a/examples/webengine/lifecycle/main.cpp +++ b/examples/webengine/lifecycle/main.cpp @@ -58,8 +58,8 @@ int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("QtExamples"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); QtWebEngine::initialize(); + QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/WebBrowser.qml"))); return app.exec(); diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml index 2d3168382..c595c3bc5 100644 --- a/examples/webengine/quicknanobrowser/BrowserWindow.qml +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -133,6 +133,10 @@ ApplicationWindow { } } Action { + shortcut: StandardKey.Quit + onTriggered: browserWindow.close() + } + Action { shortcut: "Escape" onTriggered: { if (currentWebView.state == "FullScreen") { @@ -268,7 +272,7 @@ ApplicationWindow { id: faviconImage width: 16; height: 16 sourceSize: Qt.size(width, height) - source: currentWebView && currentWebView.icon + source: currentWebView && currentWebView.icon ? currentWebView.icon : '' } style: TextFieldStyle { padding { @@ -395,11 +399,25 @@ ApplicationWindow { var tab = addTab("", tabComponent); // We must do this first to make sure that tab.active gets set so that tab.item gets instantiated immediately. tab.active = true; - tab.title = Qt.binding(function() { return tab.item.title }); + tab.title = Qt.binding(function() { return tab.item.title ? tab.item.title : 'New Tab' }); tab.item.profile = profile; return tab; } + function indexOfView(view) { + for (let i = 0; i < tabs.count; ++i) + if (tabs.getTab(i).item == view) + return i + return -1 + } + + function removeView(index) { + if (tabs.count > 1) + tabs.removeTab(index) + else + browserWindow.close(); + } + anchors.top: parent.top anchors.bottom: devToolsView.top anchors.left: parent.left @@ -447,7 +465,7 @@ ApplicationWindow { color: control.hovered ? "#ccc" : tabRectangle.color Text {text: "x" ; anchors.centerIn: parent ; color: "gray"} }} - onClicked: tabs.removeTab(styleData.index); + onClicked: tabs.removeView(styleData.index) } } } @@ -564,12 +582,7 @@ ApplicationWindow { reloadTimer.running = true; } - onWindowCloseRequested: { - if (tabs.count == 1) - browserWindow.close(); - else - tabs.removeTab(tabs.currentIndex); - } + onWindowCloseRequested: tabs.removeView(tabs.indexOfView(webEngineView)) onSelectClientCertificate: function(selection) { selection.certificates[0].select(); |