blob: 9212d18671d023a83552034881473263c1716664 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
import QtQuick 2.0
Rectangle {
width: 800
height: 600
color: "red"
Image {
id: image
source: state == 1 || state == 3 ? "/Users/gunnar/Pictures/big.jpg" : ""
width: 300
height: 200
asynchronous: true
opacity: source == "" ? 0 : 1
property int state: 0
Behavior on opacity {
NumberAnimation { duration: 250 }
}
}
Rectangle {
anchors.fill: text
anchors.margins: -10
color: "black"
radius: 5
}
Text {
id: text
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: 20
color: "white"
text: image.asynchronous ? "Loading in a thread" : "Not loading in a thread"
}
Rectangle {
anchors.centerIn: parent
width: 200
height: 200
border.width: 4
border.color: "black"
color: "white"
NumberAnimation on rotation {
from: 0
to: 360
duration: 2500
loops: Animation.Infinite
}
}
MouseArea {
anchors.fill: parent
onClicked: {
image.state = (image.state + 1) % 4;
}
}
}
|