summaryrefslogtreecommitdiffstats
path: root/examples/webengine/quicknanobrowser/BrowserWindow.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/webengine/quicknanobrowser/BrowserWindow.qml')
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml48
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index f451c8c07..f61bce268 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -52,12 +52,26 @@ ApplicationWindow {
id: browserWindow
property QtObject applicationRoot
property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item : null
+ property int previousVisibility: Window.Windowed
+
+ property bool isFullScreen: visibility == Window.FullScreen
+ onIsFullScreenChanged: {
+ // This is for the case where the system forces us to leave fullscreen.
+ if (currentWebView && !isFullScreen) {
+ currentWebView.state = ""
+ if (currentWebView.isFullScreen)
+ currentWebView.fullScreenCancelled()
+ }
+ }
width: 1300
height: 900
visible: true
title: currentWebView && currentWebView.title
+ // Make sure the Qt.WindowFullscreenButtonHint is set on OS X.
+ Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
+
// Create a styleItem to determine the platform.
// When using style "mac", ToolButtons are not supposed to accept focus.
StyleItem { id: styleItem }
@@ -124,6 +138,13 @@ ApplicationWindow {
}
}
Action {
+ shortcut: "Escape"
+ onTriggered: {
+ if (browserWindow.isFullScreen)
+ browserWindow.visibility = browserWindow.previousVisibility
+ }
+ }
+ Action {
shortcut: "Ctrl+0"
onTriggered: currentWebView.zoomFactor = 1.0;
}
@@ -289,6 +310,21 @@ ApplicationWindow {
}
}
+ states: [
+ State {
+ name: "FullScreen"
+ PropertyChanges {
+ target: tabs
+ frameVisible: false
+ tabsVisible: false
+ }
+ PropertyChanges {
+ target: navigationBar
+ visible: false
+ }
+ }
+ ]
+
onCertificateError: {
error.defer()
sslDialog.enqueue(error)
@@ -308,6 +344,18 @@ ApplicationWindow {
request.openIn(window.currentWebView)
}
}
+
+ onFullScreenRequested: {
+ if (request.toggleOn) {
+ webEngineView.state = "FullScreen"
+ browserWindow.previousVisibility = browserWindow.visibility
+ browserWindow.showFullScreen()
+ } else {
+ webEngineView.state = ""
+ browserWindow.visibility = browserWindow.previousVisibility
+ }
+ request.accept()
+ }
}
}
}