Commit e95e77d9 authored by Han Young's avatar Han Young
Browse files

fix Keyboard input event bug

parent 6a8f2c11
...@@ -30,7 +30,8 @@ Kirigami.Page { ...@@ -30,7 +30,8 @@ Kirigami.Page {
Keys.onPressed: { Keys.onPressed: {
switch(event.key) { switch(event.key) {
case Qt.Backspace || Qt.Delete: case Qt.Key_Delete:
case Qt.Key_Backspace:
inputManager.backspace(); break; inputManager.backspace(); break;
case Qt.Key_0: case Qt.Key_0:
inputManager.append("0"); break; inputManager.append("0"); break;
...@@ -40,9 +41,9 @@ Kirigami.Page { ...@@ -40,9 +41,9 @@ Kirigami.Page {
inputManager.append("+"); break; inputManager.append("+"); break;
case Qt.Key_Minus: case Qt.Key_Minus:
inputManager.append("-"); break; inputManager.append("-"); break;
case Qt.Key_multiply: case Qt.Key_Asterisk:
inputManager.append("*"); break; inputManager.append("*"); break;
case Qt.Key_division: case Qt.Key_Slash:
inputManager.append("/"); break; inputManager.append("/"); break;
case Qt.Key_Ampersand: case Qt.Key_Ampersand:
inputManager.append("&"); break; inputManager.append("&"); break;
...@@ -57,10 +58,12 @@ Kirigami.Page { ...@@ -57,10 +58,12 @@ Kirigami.Page {
case Qt.Key_Enter: case Qt.Key_Enter:
inputManager.equal(); break; inputManager.equal(); break;
} }
event.accepted = true;
} }
onIsCurrentPageChanged: { onIsCurrentPageChanged: {
inputManager.setBinaryMode(true) if (!inputManager.binaryMode)
inputManager.binaryMode = true
} }
background: Rectangle { background: Rectangle {
......
...@@ -38,7 +38,8 @@ Kirigami.Page { ...@@ -38,7 +38,8 @@ Kirigami.Page {
Keys.onPressed: { Keys.onPressed: {
switch(event.key) { switch(event.key) {
case Qt.Backspace || Qt.Delete: case Qt.Key_Delete:
case Qt.Key_Backspace:
inputManager.backspace(); break; inputManager.backspace(); break;
case Qt.Key_0: case Qt.Key_0:
inputManager.append("0"); break; inputManager.append("0"); break;
...@@ -64,9 +65,9 @@ Kirigami.Page { ...@@ -64,9 +65,9 @@ Kirigami.Page {
inputManager.append("+"); break; inputManager.append("+"); break;
case Qt.Key_Minus: case Qt.Key_Minus:
inputManager.append("-"); break; inputManager.append("-"); break;
case Qt.Key_multiply: case Qt.Key_Asterisk:
inputManager.append("×"); break; inputManager.append("×"); break;
case Qt.Key_division: case Qt.Key_Slash:
inputManager.append("÷"); break; inputManager.append("÷"); break;
case Qt.Key_AsciiCircum: case Qt.Key_AsciiCircum:
inputManager.append("^"); break; inputManager.append("^"); break;
...@@ -77,12 +78,13 @@ Kirigami.Page { ...@@ -77,12 +78,13 @@ Kirigami.Page {
case Qt.Key_Enter: case Qt.Key_Enter:
inputManager.equal(); break; inputManager.equal(); break;
} }
event.accepted = true;
} }
// Changes the current mode of the backend to non-binary // Changes the current mode of the backend to non-binary
onIsCurrentPageChanged: { onIsCurrentPageChanged: {
if (inputManager.binaryMode()) if (inputManager.binaryMode)
inputManager.setBinaryMode(false); inputManager.binaryMode = false
} }
background: Rectangle { background: Rectangle {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment