blob: 834f3428b0cb0befc9c7464b4a4ba67d8943349b (
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
73
74
75
76
77
78
79
80
81
82
83
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Layouts
import "."
Rectangle {
id: root
color: "transparent"
property var stock: null
GridLayout {
id: stockInfoLayout
anchors.fill: parent
columns: 2
rows: 3
rowSpacing: 4
Text {
id: stockIdText
color: "#000000"
font.family: Settings.fontFamily
font.pointSize: 28
font.weight: Font.DemiBold
text: root.stock.stockId
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
Layout.leftMargin: 10
}
Text {
id: price
color: "#6d6d6d"
font.family: Settings.fontFamily
font.pointSize: 28
font.weight: Font.DemiBold
text: parseFloat(root.stock.stockPrice).toFixed(2);
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
Layout.leftMargin: 5
}
Text {
id: stockNameText
color: "#0c0c0c"
font.family: Settings.fontFamily
font.pointSize: 16
elide: Text.ElideRight
maximumLineCount: 3
wrapMode: Text.WordWrap
text: root.stock.stockName
Layout.leftMargin: 10
Layout.columnSpan: 2
Layout.alignment: Qt.AlignLeft
}
Text {
id: priceChange
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.leftMargin: 10
color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
font.family: Settings.fontFamily
font.pointSize: 18
text: parseFloat(root.stock.stockPriceChanged).toFixed(2);
}
Text {
id: priceChangePercentage
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
font.family: Settings.fontFamily
font.pointSize: 18
font.weight: Font.DemiBold
Layout.fillWidth: true
text: "(" +
parseFloat(root.stock.stockPriceChanged /
(root.stock.stockPrice - root.stock.stockPriceChanged) * 100.0).toFixed(2) +
"%)"
}
}
}
|