diff options
| author | Shawn Rutledge <shawn.rutledge@qt.io> | 2023-05-16 10:51:36 +0200 |
|---|---|---|
| committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2023-05-16 22:03:00 +0000 |
| commit | 94475c9e533dc8b05c606c92b91ab2b645960ac0 (patch) | |
| tree | 68243282bb0e97cfe0a168590ceddf7726458744 /src/quick/doc/snippets/qml/splashWindow.qml | |
| parent | 78d2cec488f8ab4ab45433ae9a9039f9cb7a5771 (diff) | |
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>
Diffstat (limited to 'src/quick/doc/snippets/qml/splashWindow.qml')
| -rw-r--r-- | src/quick/doc/snippets/qml/splashWindow.qml | 57 |
1 files changed, 57 insertions, 0 deletions
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] |
