aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmetatype/data/Components/App.qml
blob: 57b2b4520a14f5d7c565340d30d2a40da8db6284 (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
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQml 2.0

import Components 1.0

QtObject {
    id: mainRect

    property int appState: App.AppState.Blue
    property string color: "blue"

    enum AppState {
        Red,
        Green,
        Blue
    }

    onAppStateChanged: {
        if (appState === App.AppState.Green)
            mainRect.color = "green"
        else if (appState === App.AppState.Red)
            mainRect.color = "red"
    }

    property Timer timer: Timer {
        onTriggered: appState = App.AppState.Green
        running: true
        interval: 100
    }
}