aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickbehaviors/data/qtbug21549-2.qml
blob: 4c3d4a0d263b342ef1a457a0e6defe90719da7d4 (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
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.0

Item {
    width: 400; height: 400

    property alias animRunning: springAnim.running

    Rectangle {
        objectName: "myRect"
        color: "green"
        width: 20; height: 20

        property bool triggered: false

        onXChanged: {
            if (!triggered && x > 50 && x < 80) {
                triggered = true
                x = x //set same value
            }
        }

        Behavior on x {
            SpringAnimation {
                id: springAnim
                spring: 3
                damping: 0.2
                mass: .5
            }
        }
    }
}