aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/auto/changes/changing_textcanvas.qml
blob: 58094e1bd0f1d4ec17758bea8612f8109da36f95 (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
import QtQuick 2.0

Item {
    id: root;
    property int count: 100;
    property int staticCount: 1000;

    property real t;
    NumberAnimation on t { from: 0; to: 1; duration: 2347; loops: Animation.Infinite }

    Repeater {
        id: repeater
        model: root.count
        Canvas {

            x: Math.floor( Math.random() * root.width )
            y: Math.floor( Math.random() * root.height )

            width: 40
            height: 15

            property real t: root.t;
            onTChanged: requestPaint();

            onPaint: {
                var ctx = getContext("2d");
                ctx.clearRect(0, 0, width, height);
                ctx.fillText("" + Math.floor( t * 1000 ) / 1000, 0, 10);
            }

        }

    }
}