summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-02-19 13:27:34 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-02-19 13:27:34 +0100
commit1e204ff6e91227de3bd2f105a1efbaf47ee2b5aa (patch)
tree1609ebd46902d5c568d3df08e593ff2b5919cbbc /examples
parent18b0081aeda8fcd5c2d756c47bdd63cb7f89e891 (diff)
parent8b048ef2ba4e8414f4852f791964878a6dc3f00f (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Blacklisted one test requiring an update of qt5.git. Conflicts: .qmake.conf Change-Id: I75e55a1c5f8840cde55ddb60d632287b2affadeb
Diffstat (limited to 'examples')
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml31
1 files changed, 22 insertions, 9 deletions
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();