blob: c790fa5c1f23c5203b336db252155fcad800f8eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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]
|