forked from brmlab/brmbar-github
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 {
|
||||
property string keys: ""
|
||||
property string enteredText: ""
|
||||
property int gridRows: 0
|
||||
property int gridColumns: 0
|
||||
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 userdbid: ""
|
||||
property variant amount: ""
|
||||
property variant amount: credit_pad.enteredText
|
||||
|
||||
Text {
|
||||
id: item_name
|
||||
|
@ -49,12 +49,14 @@ Item {
|
|||
x: 65
|
||||
y: 195
|
||||
visible: parent.username != ""
|
||||
onLetterEntered: { amount = amount.toString() + letter; }
|
||||
onLetterBackspace: { amount = amount.toString().replace(/.$/, ''); }
|
||||
focus: parent.username != ""
|
||||
Keys.onReturnPressed: { charge_button.buttonClick() }
|
||||
Keys.onEscapePressed: { cancel.buttonClick() }
|
||||
}
|
||||
|
||||
BarcodeInput {
|
||||
color: "#00ff00" /* just for debugging */
|
||||
focus: parent.username == ""
|
||||
onAccepted: {
|
||||
var acct = shop.barcodeInput(text)
|
||||
text = ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue