summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/quicknanobrowser/quickwindow.qml46
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/quick/quicknanobrowser/quickwindow.qml b/examples/quick/quicknanobrowser/quickwindow.qml
index 88fc9f8a0..d72c30021 100644
--- a/examples/quick/quicknanobrowser/quickwindow.qml
+++ b/examples/quick/quicknanobrowser/quickwindow.qml
@@ -44,6 +44,7 @@ import QtWebEngine.experimental 1.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0
+import QtQuick.Window 2.1
import QtQuick.Controls.Private 1.0
ApplicationWindow {
@@ -51,11 +52,21 @@ ApplicationWindow {
function load(url) { tabs.currentView.url = url }
function adoptHandle(viewHandle) { tabs.currentView.adoptHandle(viewHandle) }
+ property bool isFullScreen: visibility == Window.FullScreen
+ onIsFullScreenChanged: {
+ // This is for the case where the system forces us to leave fullscreen.
+ if (!isFullScreen && tabs.currentView.state == "FullScreen")
+ tabs.currentView.state = ""
+ }
+
height: 600
width: 800
visible: true
title: tabs.currentView && tabs.currentView.title
+ // Make sure the Qt.WindowFullscreenButtonHint is set on Mac.
+ 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 }
@@ -92,6 +103,14 @@ ApplicationWindow {
}
}
+ Action {
+ shortcut: "Escape"
+ onTriggered: {
+ if (browserWindow.isFullScreen)
+ browserWindow.showNormal()
+ }
+ }
+
toolBar: ToolBar {
id: navigationBar
RowLayout {
@@ -174,11 +193,38 @@ ApplicationWindow {
Component {
id: tabComponent
WebEngineView {
+ id: webEngineView
function adoptHandle(viewHandle) { experimental.adoptHandle(viewHandle) }
focus: true
+ states: [
+ State {
+ name: "FullScreen"
+ PropertyChanges {
+ target: tabs
+ frameVisible: false
+ tabsVisible: false
+ }
+ PropertyChanges {
+ target: navigationBar
+ visible: false
+ }
+ }
+ ]
+
experimental {
+ isFullScreen: webEngineView.state == "FullScreen" && browserWindow.isFullScreen
+ onFullScreenRequested: {
+ if (fullScreen) {
+ webEngineView.state = "FullScreen"
+ browserWindow.showFullScreen();
+ } else {
+ webEngineView.state = ""
+ browserWindow.showNormal();
+ }
+ }
+
onCreateWindow: {
if (newViewDisposition == "popup")
print("Warning: Ignored a popup window.")