-
Notifications
You must be signed in to change notification settings - Fork 0
/
StatSlider.qml
66 lines (55 loc) · 1.37 KB
/
StatSlider.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
import QtQuick 2.0
import QtQuick.Controls 1.0
Item {
id: rootItem
height: 25
property int value: 1
property int max: 1
property int min: 1
property int remainingValues: 1
property string name: "Stat"
/*onValueChanged: {
if(value > max) {
value = max;
}
}*/
Label {
id: statLabel
y: 4
text: parent.name
anchors.left: parent.left
anchors.leftMargin: 6
anchors.verticalCenter: parent.verticalCenter
font.bold: true
}
ProgressBar {
id: statBar
y: 1
height: 22
anchors.verticalCenterOffset: 0
anchors.right: statSpinner.left
anchors.rightMargin: 3
anchors.left: parent.left
anchors.leftMargin: 90
anchors.verticalCenter: parent.verticalCenter
maximumValue: 100
minimumValue: 0
value: Math.min( ((parent.value/parent.max) * 100), maximumValue )
}
SpinBox {
id: statSpinner
x: 552
y: 0
width: 60
height: 22
anchors.right: parent.right
anchors.rightMargin: 3
anchors.verticalCenter: parent.verticalCenter
maximumValue: parent.value+parent.remainingValues
minimumValue: parent.min
value: parent.value
onValueChanged: {
parent.value = value;
}
}
}