diff options
author | Orgad Shaneh <orgads@gmail.com> | 2011-07-25 21:33:42 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2011-07-25 21:43:27 +0300 |
commit | 3962bb5474d0cabf52d202eea6e1afdfd1a61981 (patch) | |
tree | d23eec0c0c8e9747cf337a64c77d1f41cc0437ec | |
parent | 547b0af5c379bae4f07038ef12ca9c5359e51f52 (diff) |
Go to next slide on Return, go to previous slide on Backspace or right-click
-rw-r--r-- | src/Presentation.qml | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/Presentation.qml b/src/Presentation.qml index acba43d..ef788b5 100644 --- a/src/Presentation.qml +++ b/src/Presentation.qml @@ -102,9 +102,11 @@ Item { function goToUserSlide() { --userNum; - if (root.faded || userNum < 0 || userNum >= root.slides.length) + if (root.faded || userNum >= root.slides.length) return - if (root.currentSlide != userNum) { + if (userNum < 0) + goToNextSlide() + else if (root.currentSlide != userNum) { var from = slides[currentSlide] var to = slides[userNum] if (switchSlides(from, to)) { @@ -118,15 +120,18 @@ Item { Keys.onSpacePressed: goToNextSlide() Keys.onRightPressed: goToNextSlide() + Keys.onDownPressed: goToNextSlide() Keys.onLeftPressed: goToPreviousSlide() + Keys.onUpPressed: goToPreviousSlide() Keys.onEscapePressed: Qt.quit() Keys.onPressed: { if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9) userNum = 10 * userNum + (event.key - Qt.Key_0) - else - { + else { if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) goToUserSlide(); + else if (event.key == Qt.Key_Backspace) + goToPreviousSlide(); else if (event.key == Qt.Key_C) root.faded = !root.faded; userNum = 0; @@ -144,6 +149,12 @@ Item { MouseArea { id: mouseArea anchors.fill: parent - onClicked: goToNextSlide() + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if (mouse.button == Qt.RightButton) + goToPreviousSlide() + else + goToNextSlide() + } } } |