summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2023-05-16 10:51:36 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2023-05-16 22:03:00 +0000
commit94475c9e533dc8b05c606c92b91ab2b645960ac0 (patch)
tree68243282bb0e97cfe0a168590ceddf7726458744
parent78d2cec488f8ab4ab45433ae9a9039f9cb7a5771 (diff)
downloadqtdeclarative-94475c9e533dc8b05c606c92b91ab2b645960ac0.tar.gz
doc: Use part of window example for Window.flags property snippet
Pick-to: 6.2 6.5 Change-Id: I5b5c1663f626ce3bfe4c01edbc5480729a1b91f6 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
-rw-r--r--src/quick/doc/snippets/qml/images/qt-logo.pngbin0 -> 6208 bytes
-rw-r--r--src/quick/doc/snippets/qml/splashWindow.qml57
-rw-r--r--src/quick/items/qquickwindow.cpp4
3 files changed, 60 insertions, 1 deletions
diff --git a/src/quick/doc/snippets/qml/images/qt-logo.png b/src/quick/doc/snippets/qml/images/qt-logo.png
new file mode 100644
index 0000000000..30c621c9c6
--- /dev/null
+++ b/src/quick/doc/snippets/qml/images/qt-logo.png
Binary files differ
diff --git a/src/quick/doc/snippets/qml/splashWindow.qml b/src/quick/doc/snippets/qml/splashWindow.qml
new file mode 100644
index 0000000000..c790fa5c1f
--- /dev/null
+++ b/src/quick/doc/snippets/qml/splashWindow.qml
@@ -0,0 +1,57 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [entire]
+import QtQuick
+
+Window {
+ id: mainWindow
+ title: "Main Window"
+ color: "#456"
+ property real defaultSpacing: 10
+
+ property Splash splash: Splash {
+ onTimeout: mainWindow.show()
+ }
+
+ component Splash: Window {
+ id: splash
+
+ // a splash screen has no titlebar
+ flags: Qt.SplashScreen
+ // the transparent color lets background behind the image edges show through
+ color: "transparent"
+ modality: Qt.ApplicationModal // in case another application window is showing
+ title: "Splash Window" // for the taskbar/dock, task switcher etc.
+ visible: true
+
+ // here we use the Screen attached property to center the splash window
+ //! [screen-properties]
+ x: (Screen.width - splashImage.width) / 2
+ y: (Screen.height - splashImage.height) / 2
+ //! [screen-properties]
+ width: splashImage.width
+ height: splashImage.height
+
+ property int timeoutInterval: 2000
+ signal timeout
+
+ Image {
+ id: splashImage
+ source: "images/qt-logo.png"
+ }
+
+ TapHandler {
+ onTapped: splash.timeout()
+ }
+
+ Timer {
+ interval: splash.timeoutInterval; running: true; repeat: false
+ onTriggered: {
+ splash.visible = false
+ splash.timeout()
+ }
+ }
+ }
+}
+//! [entire]
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 4684fb291e..666b62b82f 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3299,9 +3299,11 @@ void QQuickWindow::endExternalCommands()
whether it's a dialog, popup, or a regular window, and whether it should
have a title bar, etc.
- The flags which you read from this property might differ from the ones
+ The flags that you read from this property might differ from the ones
that you set if the requested flags could not be fulfilled.
+ \snippet qml/splashWindow.qml entire
+
\sa Qt::WindowFlags
*/