mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 21:33:59 +02:00
brmbarv3 BarKeyboard: Allow keyboard text entry; use in ChargeCredit
This commit is contained in:
parent
0801bc24cb
commit
a5ffdf27e8
2 changed files with 16 additions and 3 deletions
|
@ -2,6 +2,7 @@ import Qt 4.7
|
||||||
|
|
||||||
Grid {
|
Grid {
|
||||||
property string keys: ""
|
property string keys: ""
|
||||||
|
property string enteredText: ""
|
||||||
property int gridRows: 0
|
property int gridRows: 0
|
||||||
property int gridColumns: 0
|
property int gridColumns: 0
|
||||||
property int buttonWidth: 70
|
property int buttonWidth: 70
|
||||||
|
@ -38,4 +39,14 @@ Grid {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLetterEntered: { enteredText = enteredText.toString() + letter; }
|
||||||
|
onLetterBackspace: { enteredText = enteredText.toString().replace(/.$/, ''); }
|
||||||
|
Keys.onPressed: {
|
||||||
|
if (event.key == Qt.Key_Backspace) {
|
||||||
|
enteredText = enteredText.toString().replace(/.$/, '');
|
||||||
|
} else {
|
||||||
|
enteredText = enteredText.toString() + event.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ Item {
|
||||||
|
|
||||||
property variant username: ""
|
property variant username: ""
|
||||||
property variant userdbid: ""
|
property variant userdbid: ""
|
||||||
property variant amount: ""
|
property variant amount: credit_pad.enteredText
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: item_name
|
id: item_name
|
||||||
|
@ -49,12 +49,14 @@ Item {
|
||||||
x: 65
|
x: 65
|
||||||
y: 195
|
y: 195
|
||||||
visible: parent.username != ""
|
visible: parent.username != ""
|
||||||
onLetterEntered: { amount = amount.toString() + letter; }
|
focus: parent.username != ""
|
||||||
onLetterBackspace: { amount = amount.toString().replace(/.$/, ''); }
|
Keys.onReturnPressed: { charge_button.buttonClick() }
|
||||||
|
Keys.onEscapePressed: { cancel.buttonClick() }
|
||||||
}
|
}
|
||||||
|
|
||||||
BarcodeInput {
|
BarcodeInput {
|
||||||
color: "#00ff00" /* just for debugging */
|
color: "#00ff00" /* just for debugging */
|
||||||
|
focus: parent.username == ""
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
var acct = shop.barcodeInput(text)
|
var acct = shop.barcodeInput(text)
|
||||||
text = ""
|
text = ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue