• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import QtQuick 2.4
2import QtQuick.Controls 1.1
3import QtQuick.Controls.Styles 1.1
4import QtQuick.Dialogs 1.1
5import QtQuick.Window 2.1
6
7ApplicationWindow {
8    id: window
9    visible: true
10    width: 640
11    height: 480
12    x: 30
13    y: 30
14    color: "dodgerblue"
15
16    Item {
17        anchors.fill: parent
18
19        Rectangle {
20            color: Qt.rgba(1, 1, 1, 0.7)
21            border.width: 1
22            border.color: "white"
23            anchors.bottomMargin: 15
24            anchors.horizontalCenter: parent.horizontalCenter
25            width : parent.width - 30
26            height: parent.height - 30
27            radius: 8
28
29            Text {
30                id: text1
31                anchors.centerIn: parent
32                text: "Hello World!"
33                font.pointSize: 24
34                visible: timer.tex1_visible
35            }
36
37            Text {
38                id: text2
39                anchors.centerIn: parent
40                text: "This is qmlglsrc demo!"
41                font.pointSize: 24
42                visible: timer.tex2_visible
43            }
44
45            Timer {
46                id: timer
47                property int count: 0
48                property int tex1_visible: 1
49                property int tex2_visible: 0
50                interval: 30; running: true; repeat: true
51                onTriggered: {
52                  count++;
53                  if (count%2 == 0) {
54                    tex1_visible = 1;
55                    tex2_visible = 0;
56                  }
57                  else {
58                    tex1_visible = 0;
59                    tex2_visible = 1;
60                  }
61                }
62            }
63        }
64    }
65}
66