From 554dbc7d2977680a781ce31b50ea99bbd51ce08f Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 21 Mar 2023 10:33:15 -0500 Subject: [PATCH] more versatile key handling This allows us to later add and tweak the keyboard keys used to navigate the slides and UI. --- src/qml/presenter/Presentation.qml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index b5c57d6..9a46402 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -289,11 +289,26 @@ FocusScope { id: keyHandler /* anchors.fill: parent */ focus: true - Keys.onLeftPressed: previousSlideAction() - Keys.onRightPressed: nextSlideAction() - Keys.onUpPressed: previousSlideAction() - Keys.onDownPressed: nextSlideAction() - Keys.onSpacePressed: nextSlideAction() + Keys.onPressed: { + if (event.key == Qt.Key_J) + nextSlideAction(); + if (event.key == Qt.Key_L) + nextSlideAction(); + if (event.key == Qt.Key_Right) + nextSlideAction(); + if (event.key == Qt.Key_Down) + nextSlideAction(); + if (event.key == Qt.Key_K) + previousSlideAction(); + if (event.key == Qt.Key_H) + previousSlideAction(); + if (event.key == Qt.Key_Up) + previousSlideAction(); + if (event.key == Qt.Key_Left) + previousSlideAction(); + if (event.key == Qt.Key_P) + SlideObject.playPause(); + } } Connections {