2020-06-12 20:53:01 +02:00
|
|
|
import QtQuick 2.14
|
|
|
|
|
import Flowee.org.pay 1.0
|
|
|
|
|
|
|
|
|
|
FocusScope {
|
2020-06-12 23:37:32 +02:00
|
|
|
id: root
|
2020-06-12 20:53:01 +02:00
|
|
|
height: balance.height + 16
|
|
|
|
|
width: balance.width + 16
|
|
|
|
|
focus: true
|
|
|
|
|
activeFocusOnTab: true
|
|
|
|
|
|
|
|
|
|
property alias value: privValue.value
|
2020-06-12 23:37:32 +02:00
|
|
|
property alias valueObject: privValue
|
2020-06-12 20:53:01 +02:00
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
|
privValue.enteredString = "0";
|
|
|
|
|
privValue.value = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BitcoinValue {
|
|
|
|
|
id: privValue
|
|
|
|
|
}
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
2020-06-12 23:37:32 +02:00
|
|
|
onClicked: root.focus = true
|
2020-06-12 20:53:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BitcoinAmountLabel {
|
|
|
|
|
id: balance
|
|
|
|
|
x: 8
|
|
|
|
|
y: 8
|
2020-06-12 23:37:32 +02:00
|
|
|
value: root.value
|
2020-06-12 20:53:01 +02:00
|
|
|
colorize: false
|
2020-06-12 23:37:32 +02:00
|
|
|
visible: !root.activeFocus
|
2020-06-12 20:53:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
text: privValue.enteredString
|
2020-06-12 23:37:32 +02:00
|
|
|
visible: root.activeFocus
|
2020-06-12 20:53:01 +02:00
|
|
|
x: 8
|
|
|
|
|
y: 8
|
|
|
|
|
}
|
|
|
|
|
Text {
|
|
|
|
|
id: unit
|
|
|
|
|
text: Flowee.unitName
|
|
|
|
|
y: 8
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 8
|
2020-06-12 23:37:32 +02:00
|
|
|
visible: root.activeFocus
|
2020-06-12 20:53:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle { // focus scope indicator
|
|
|
|
|
anchors.fill: parent
|
2020-06-12 23:37:32 +02:00
|
|
|
border.color: root.activeFocus ? "#0066ff" : "#bdbdbd"
|
2020-06-12 20:53:01 +02:00
|
|
|
border.width: 1
|
|
|
|
|
color: "#00000000" // transparant
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Keys.onPressed: {
|
|
|
|
|
if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9) {
|
|
|
|
|
privValue.addNumber(event.key);
|
|
|
|
|
event.accepted = true
|
|
|
|
|
}
|
|
|
|
|
else if (event.key === 44 || event.key === 46) {
|
|
|
|
|
privValue.addSeparator();
|
|
|
|
|
event.accepted = true
|
|
|
|
|
}
|
|
|
|
|
else if (event.key === Qt.Key_Backspace) {
|
|
|
|
|
privValue.backspacePressed();
|
|
|
|
|
event.accepted = true
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-22 12:14:13 +02:00
|
|
|
Shortcut {
|
|
|
|
|
sequence: StandardKey.Paste
|
|
|
|
|
onActivated: privValue.paste()
|
|
|
|
|
}
|
2020-06-12 20:53:01 +02:00
|
|
|
}
|