diff options
Diffstat (limited to 'examples/declarative')
-rw-r--r-- | examples/declarative/snow/snow.qml | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml index aed426f..5dd0006 100644 --- a/examples/declarative/snow/snow.qml +++ b/examples/declarative/snow/snow.qml @@ -48,23 +48,22 @@ Rect { } Script { - function leftPressed() { + function left() { if (selectedItemColumn <= 0) return; selectedItemColumn -= 1; MyLayout.slowDeform = false; MyLayout.targetDeform = Math.max(Math.min(MyLayout.deform - 0.1, -0.1), -0.4); } - function rightPressed() { + function right() { selectedItemColumn += 1; MyLayout.slowDeform = false; MyLayout.targetDeform = Math.min(Math.max(MyLayout.deform + 0.1, 0.1), 0.4); } } - KeyActions { - focus: true - leftArrow: "leftPressed()" - rightArrow: "rightPressed()" - upArrow: "if (selectedItemRow > 0) selectedItemRow = selectedItemRow - 1" - downArrow: "if (selectedItemRow < 3) selectedItemRow = selectedItemRow + 1" - } + + focus: true + Keys.onLeftPressed: "left()" + Keys.onRightPressed: "right()" + Keys.onUpPressed: "if (selectedItemRow > 0) selectedItemRow = selectedItemRow - 1" + Keys.onDownPressed: "if (selectedItemRow < 3) selectedItemRow = selectedItemRow + 1" } |