Debian Codegraph @

tests/examples/qt6/qmlsrc/main.qml

raw
1 // SPDX-License-Identifier: BSD-2-Clause
2 //
3 // Copyright (C) 2022, Matthew Waters <[email protected]>
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // a) Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 //
11 // b) Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in
13 // the documentation and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 // THE POSSIBILITY OF SUCH DAMAGE.
26
27 import QtQuick 6.0
28 import QtQuick.Controls 6.0
29 import QtQuick.Dialogs 6.0
30 import QtQuick.Window 6.0
31
32 ApplicationWindow {
33 id: window
34 visible: true
35 width: 640
36 height: 480
37 x: 30
38 y: 30
39 color: "dodgerblue"
40
41 Item {
42 anchors.fill: parent
43
44 Rectangle {
45 color: Qt.rgba(1, 1, 1, 0.7)
46 border.width: 1
47 border.color: "white"
48 anchors.bottomMargin: 15
49 anchors.horizontalCenter: parent.horizontalCenter
50 width : parent.width - 30
51 height: parent.height - 30
52 radius: 8
53
54 Text {
55 id: text1
56 anchors.centerIn: parent
57 text: "Hello World!"
58 font.pointSize: 24
59 visible: timer.tex1_visible
60 }
61
62 Text {
63 id: text2
64 anchors.centerIn: parent
65 text: "This is qmlglsrc demo!"
66 font.pointSize: 24
67 visible: timer.tex2_visible
68 }
69
70 Timer {
71 id: timer
72 property int count: 0
73 property int tex1_visible: 1
74 property int tex2_visible: 0
75 interval: 30; running: true; repeat: true
76 onTriggered: {
77 count++;
78 if (count%2 == 0) {
79 tex1_visible = 1;
80 tex2_visible = 0;
81 }
82 else {
83 tex1_visible = 0;
84 tex2_visible = 1;
85 }
86 }
87 }
88 }
89 }
90 }