C

Qt Quick Ultralite studio_components Example

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
import QtQuick

Item {
    id: root

    property bool activated: false
    property bool hasOutlineArc: true

    signal changeArcWidth(int arcWidth)
    signal changeFillColor(int colorNumber)
    signal switchOutlineArc
    signal switchRound

    function restart() {
        root.activated = false;
        tmIdle.restart();
    }

    Timer {
        id: tmIdle
        interval: 10000
        repeat: true
        running: true

        onTriggered: {
            root.activated = true;
        }
    }
    Timer {
        id: tmOutlineArc
        interval: root.hasOutlineArc ? 12000 : 8000
        repeat: true
        running: root.activated

        onTriggered: {
            root.switchOutlineArc();
        }
    }
    Timer {
        id: tmRound
        interval: 2500
        repeat: true
        running: root.activated && root.hasOutlineArc

        onTriggered: {
            switchRound();
        }
    }
    Timer {
        id: tmArcWidth

        property int index: 0

        interval: 4000
        repeat: true
        running: root.activated && root.hasOutlineArc

        onTriggered: {
            tmArcWidth.index = (tmArcWidth.index + 1) % 3;
            switch (tmArcWidth.index) {
            case 1:
                root.changeArcWidth(8);
                break;
            case 2:
                root.changeArcWidth(40);
                break;
            default:
                root.changeArcWidth(28);
                break;
            }
        }
    }
    Timer {
        id: tmFillColor

        property int index: 0

        interval: 2000
        repeat: true
        running: root.activated

        onTriggered: {
            tmFillColor.index = (tmFillColor.index + 1) % 4;
            root.changeFillColor(tmFillColor.index);
        }
    }
}