-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrencyItem.qml
71 lines (59 loc) · 1.54 KB
/
CurrencyItem.qml
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
import QtQuick 2.0
Item {
id: root
property alias currency: currencyLabel.text
property alias price: priceLabel.text
property color color
implicitHeight: parent.height
implicitWidth: parent.width / 3
Text {
id: currencyLabel
anchors {
top: parent.top
left: parent.left
right: parent.right
bottom: priceLabel.top
leftMargin: 8
rightMargin: 8
}
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignBottom
font.pointSize: 34
fontSizeMode: Text.Fit
color: "#8a000000"
font.family: "Oswald, LiHei Pro, sans-serif"
font.weight: Font.Normal
}
Text {
id: priceLabel
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
leftMargin: 8
rightMargin: 8
bottomMargin: -8
}
height: parent.height * .724
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
font.pointSize: 112
fontSizeMode: Text.Fit
color: root.color
font.family: "Oswald"
font.weight: Font.Normal
onTextChanged: animation.play()
}
NumberAnimation {
id: animation
target: priceLabel
property: "opacity"
from: 0.5; to: 1
duration: 500
easing.type: Easing.OutBack
function play() {
if (running) stop()
start()
}
}
}