summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dial/DialLibrary/Dial.qml
blob: 1a163a8f64ca6a8bb51fda33d52fa19e6dbd5542 (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
35
36
37
38
import Qt 4.6

Item {
    id: Root
    property real value : 0

    width: 210; height: 210

    Image { id: Background; source: "background.png" }

    Image {
        x: 93
        y: 35
        source: "needle_shadow.png"
        transform: Rotation {
            origin.x: 11; origin.y: 67
            angle: NeedleRotation.angle
        }
    }
    Image {
        id: Needle
        x: 95; y: 33
        smooth: true
        source: "needle.png"
        transform: Rotation {
            id: NeedleRotation
            origin.x: 7; origin.y: 65
            angle: -130
            angle: SpringFollow {
                id: MyFollow
                spring: 1.4
                damping: .15
                source: Math.min(Math.max(-130, Root.value*2.2 - 130), 133)
            }
        }
    }
    Image { x: 21; y: 18; source: "overlay.png" }
}