aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml/windowVisibility.qml
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2023-05-16 10:16:20 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2023-05-20 15:15:55 +0200
commit36e3ea45f9df38ee0f2e1e619a8c344357d56896 (patch)
tree6671cfc9e333c98090549fa2194752110c9b2819 /src/quick/doc/snippets/qml/windowVisibility.qml
parent1022dd338e49bfc297f94a39383a2043cbb4eb62 (diff)
doc: Add Window.visibility property snippet; link to Window example
Probably we'll keep the Window and Screen example: it has walkthrough docs already. Snippets can be used to illustrate some simplified scenarios, while the example is a bit fancier. Likewise, link to the Window and Screen example from the Screen docs. Pick-to: 6.2 6.5 Change-Id: I20c803affd1f4b6d44b41520782e5ad3c69fc871 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'src/quick/doc/snippets/qml/windowVisibility.qml')
-rw-r--r--src/quick/doc/snippets/qml/windowVisibility.qml29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/quick/doc/snippets/qml/windowVisibility.qml b/src/quick/doc/snippets/qml/windowVisibility.qml
new file mode 100644
index 0000000000..fcdbd5aef1
--- /dev/null
+++ b/src/quick/doc/snippets/qml/windowVisibility.qml
@@ -0,0 +1,29 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [entire]
+import QtQuick
+import QtQuick.Controls
+
+Window {
+ id: win
+ flags: Qt.Window | Qt.WindowFullscreenButtonHint
+ visibility: fullscreenButton.checked ? Window.FullScreen : Window.Windowed
+
+ Button {
+ id: fullscreenButton
+ anchors {
+ right: parent.right
+ top: parent.top
+ margins: 6
+ }
+ width: height
+ checkable: true
+ Binding on checked { value: win.visibility === Window.FullScreen }
+ text: "⛶"
+ ToolTip.visible: hovered
+ ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
+ ToolTip.text: win.visibility === Window.FullScreen ? qsTr("restore") : qsTr("fill screen")
+ }
+}
+//! [entire]