Image based busy indicator
[qt-components:desktop.git] / components / BusyIndicator.qml
1 import QtQuick 1.1
2
3 Item {
4         id: indicator
5
6         property alias running : rotation.running
7         property Style platformStyle: BusyIndicatorStyle {}
8
9         property int _leafCount: 12
10         property real _rotation: 360 / _leafCount
11
12         implicitWidth: platformStyle.size === "small" ? 16 : platformStyle.size === "medium" ? 32 : 128;
13         implicitHeight: implicitWidth
14
15         Image {
16                 id: spinner
17                 source: "images/busy_indicator_" + indicator.implicitWidth + (platformStyle.inverted ? "_inverted" : "") + ".png"
18                 smooth: true
19         }
20
21         Timer {
22                 id: rotation
23                 interval: platformStyle.period / _leafCount
24                 running: true
25                 repeat: true
26                 onTriggered: {
27                         spinner.rotation = spinner.rotation + _rotation;
28                 }
29         }
30 }