[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [gcompris/devel2] src/activities/imageid: imageid, add key navigation
From: Bruno Coudoin <bruno.coudoin () gcompris ! net>
Date: 2014-12-31 18:34:16
Message-ID: E1Y6O64-0001M6-Li () scm ! kde ! org
[Download RAW message or body]
Git commit d74c9ff09807ab6acfd34c638998657a1bfa14cb by Bruno Coudoin.
Committed on 19/12/2014 at 23:08.
Pushed by bcoudoin into branch 'devel2'.
imageid, add key navigation
M +50 -2 src/activities/imageid/Imageid.qml
http://commits.kde.org/gcompris/d74c9ff09807ab6acfd34c638998657a1bfa14cb
diff --git a/src/activities/imageid/Imageid.qml b/src/activities/imageid/Imageid.qml
index 5dfc9e5..882e825 100644
--- a/src/activities/imageid/Imageid.qml
+++ b/src/activities/imageid/Imageid.qml
@@ -44,6 +44,7 @@ ActivityBase {
property bool horizontalLayout: background.width > background.height
property Item dialog
+ property bool keyNavigation: false
signal start
signal stop
@@ -102,12 +103,42 @@ ActivityBase {
DownloadManager.updateResource("data/words/words.rcc")
}
repeatItem.visible = false
+ keyNavigation = false
activity.audioVoices.error.connect(voiceError)
activity.audioVoices.done.connect(voiceDone)
}
onStop: { Activity.stop() }
+ Keys.onRightPressed: {
+ keyNavigation = true
+ wordListView.incrementCurrentIndex()
+ }
+ Keys.onLeftPressed: {
+ keyNavigation = true
+ wordListView.decrementCurrentIndex()
+ }
+ Keys.onDownPressed: {
+ keyNavigation = true
+ wordListView.incrementCurrentIndex()
+ }
+ Keys.onUpPressed: {
+ keyNavigation = true
+ wordListView.decrementCurrentIndex()
+ }
+ Keys.onSpacePressed: {
+ keyNavigation = true
+ wordListView.currentItem.pressed()
+ }
+ Keys.onEnterPressed: {
+ keyNavigation = true
+ wordListView.currentItem.pressed()
+ }
+ Keys.onReturnPressed: {
+ keyNavigation = true
+ wordListView.currentItem.pressed()
+ }
+
JsonParser {
id: parser
@@ -166,10 +197,27 @@ ActivityBase {
orientation: Qt.Vertical
verticalLayoutDirection: ListView.TopToBottom
interactive: false
+ model: wordListModel
- property int buttonHeight: height / wordListModel.count * 0.9
+ highlight: Rectangle {
+ width: wordListView.width
+ height: wordListView.buttonHeight
+ color: "lightsteelblue"
+ radius: 5
+ visible: background.keyNavigation
+ y: wordListView.currentItem.y
+ Behavior on y {
+ SpringAnimation {
+ spring: 3
+ damping: 0.2
+ }
+ }
+ }
+ highlightFollowsCurrentItem: false
+ focus: true
+ keyNavigationWraps: true
- model: wordListModel
+ property int buttonHeight: height / wordListModel.count * 0.9
delegate: AnswerButton {
id: wordRectangle
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic