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 {
Keys.onPressed: {
switch(event.key) {
case Qt.Backspace || Qt.Delete:
case Qt.Key_Delete:
case Qt.Key_Backspace:
inputManager.backspace(); break;
case Qt.Key_0:
inputManager.append("0"); break;
......@@ -40,9 +41,9 @@ Kirigami.Page {
inputManager.append("+"); break;
case Qt.Key_Minus:
inputManager.append("-"); break;
case Qt.Key_multiply:
case Qt.Key_Asterisk:
inputManager.append("*"); break;
case Qt.Key_division:
case Qt.Key_Slash:
inputManager.append("/"); break;
case Qt.Key_Ampersand:
inputManager.append("&"); break;
......@@ -57,10 +58,12 @@ Kirigami.Page {
case Qt.Key_Enter:
inputManager.equal(); break;
}
event.accepted = true;
}
onIsCurrentPageChanged: {
inputManager.setBinaryMode(true)
if (!inputManager.binaryMode)
inputManager.binaryMode = true
}
background: Rectangle {
......
......@@ -38,7 +38,8 @@ Kirigami.Page {
Keys.onPressed: {
switch(event.key) {
case Qt.Backspace || Qt.Delete:
case Qt.Key_Delete:
case Qt.Key_Backspace:
inputManager.backspace(); break;
case Qt.Key_0:
inputManager.append("0"); break;
......@@ -64,9 +65,9 @@ Kirigami.Page {
inputManager.append("+"); break;
case Qt.Key_Minus:
inputManager.append("-"); break;
case Qt.Key_multiply:
case Qt.Key_Asterisk:
inputManager.append("×"); break;
case Qt.Key_division:
case Qt.Key_Slash:
inputManager.append("÷"); break;
case Qt.Key_AsciiCircum:
inputManager.append("^"); break;
......@@ -77,12 +78,13 @@ Kirigami.Page {
case Qt.Key_Enter:
inputManager.equal(); break;
}
event.accepted = true;
}
// Changes the current mode of the backend to non-binary
onIsCurrentPageChanged: {
if (inputManager.binaryMode())
inputManager.setBinaryMode(false);
if (inputManager.binaryMode)
inputManager.binaryMode = false
}
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