brmbarv3 Receipt: Allow keyboard text entry

This commit is contained in:
Petr Baudis 2012-10-16 22:18:47 +02:00
parent ee90915300
commit c81189889e

View file

@ -7,13 +7,14 @@ Item {
anchors.fill: parent anchors.fill: parent
property variant user property variant user
property variant description: "" property variant description: item_name_pad.enteredText
property variant amount: "" property variant amount: amount_pad.enteredText
state: "normal" state: "normal"
BarcodeInput { BarcodeInput {
color: "#00ff00" /* just for debugging */ color: "#00ff00" /* just for debugging */
focus: page.state == "normal"
onAccepted: { onAccepted: {
var acct = shop.barcodeInput(text) var acct = shop.barcodeInput(text)
text = "" text = ""
@ -63,8 +64,9 @@ Item {
x: 65 x: 65
y: 239 y: 239
visible: page.state == "description_edit" visible: page.state == "description_edit"
onLetterEntered: { page.description = page.description + letter; } focus: page.state == "description_edit"
onLetterBackspace: { page.description = page.description.replace(/.$/, ''); } Keys.onReturnPressed: { description_edit.buttonClick() }
Keys.onEscapePressed: { cancel.buttonClick() }
} }
Item { Item {
@ -117,8 +119,9 @@ Item {
x: 65 x: 65
y: 239 y: 239
visible: page.state == "amount_edit" visible: page.state == "amount_edit"
onLetterEntered: { amount = amount.toString() + letter } focus: page.state == "amount_edit"
onLetterBackspace: { amount = amount.toString().replace(/.$/, '') } Keys.onReturnPressed: { amount_edit.buttonClick() }
Keys.onEscapePressed: { cancel.buttonClick() }
} }
BarTextHint { BarTextHint {