blob: 63bde5c56cf3b16dfd1ad797f4bf124d94f1b2ac (
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
|
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.14
import QtGraphicalEffects 1.0
import "../themes/themes.js" as Theme
Image {
id: icon
height: 16
width: 16
// one of: good, medium, low
property var quality: "good"
ColorOverlay{
anchors.fill: icon
source: icon
color: getQualityColor()
antialiasing: true
}
StateGroup {
state: quality
states: [
State {
name: "good"
PropertyChanges {
target: icon
source: "../resources/reception-4.svg"
}
},
State {
name: "medium"
PropertyChanges {
target: icon
source: "../resources/reception-2.svg"
}
},
State {
name: "low"
PropertyChanges {
target: icon
source: "../resources/reception-0.svg"
}
}
]
}
function getQualityColor() {
// I like this better than with states
switch (quality) {
case "good":
return Theme.signalGood
case "medium":
return Theme.signalMedium
case "low":
return Theme.signalLow
default:
return Theme.signalGood
}
}
}
|