improved the out of focus issue

master
Qiaoyong Zhong 11 years ago
parent 92243ed48b
commit d45790cee7

@ -82,6 +82,7 @@ function moveKey(event) {
cellValues[i] = v2; cellValues[i] = v2;
} }
} }
event.accepted = true;
break; break;
case Qt.Key_Right: case Qt.Key_Right:
for (i = 0; i < gridSize; i++) { for (i = 0; i < gridSize; i++) {
@ -102,6 +103,7 @@ function moveKey(event) {
cellValues[i] = v2; cellValues[i] = v2;
} }
} }
event.accepted = true;
break; break;
case Qt.Key_Up: case Qt.Key_Up:
for (i = 0; i < gridSize; i++) { for (i = 0; i < gridSize; i++) {
@ -118,6 +120,7 @@ function moveKey(event) {
} }
} }
} }
event.accepted = true;
break; break;
case Qt.Key_Down: case Qt.Key_Down:
for (i = 0; i < gridSize; i++) { for (i = 0; i < gridSize; i++) {
@ -139,6 +142,7 @@ function moveKey(event) {
moveMergeTilesUpDown(i, v, v2, indices, false); moveMergeTilesUpDown(i, v, v2, indices, false);
} }
} }
event.accepted = true;
break; break;
} }

@ -43,6 +43,7 @@ ApplicationWindow {
Item { Item {
id: helper id: helper
focus: false
property var myColors: {"bglight": "#FAF8EF", property var myColors: {"bglight": "#FAF8EF",
"bggray": Qt.rgba(238/255, 228/255, 218/255, 0.35), "bggray": Qt.rgba(238/255, 228/255, 218/255, 0.35),
"bgdark": "#BBADA0", "bgdark": "#BBADA0",
@ -62,6 +63,11 @@ ApplicationWindow {
focus: true focus: true
Keys.onPressed: MyScript.moveKey(event) Keys.onPressed: MyScript.moveKey(event)
MouseArea {
anchors.fill: parent
onClicked: parent.forceActiveFocus()
}
Text { Text {
id: gameName id: gameName
font.family: "Sans-serif" font.family: "Sans-serif"

Loading…
Cancel
Save