first (buggy) version of keyboard usage in qml list
[mdictionary] / src / mdictionary / qml / ElementsListView.qml
index c9a7561..fa53b93 100644 (file)
@@ -30,4 +30,22 @@ ListView {
     currentIndex: 0
     highlight: Rectangle { color: "lightsteelblue"; radius: 5; width: parent.parent.width }
     highlightMoveSpeed: 1000
+
+    function setFocus() {
+        console.log("juhu2")
+        forceActiveFocus()
+//        console.log(focus + " " + activeFocus)
+    }
+
+    Keys.onPressed: {
+        console.log("woooo")
+        if (event.key == Qt.Key_Up && currentIndex < count){
+            currentIndex = currentIndex + 1
+            console.log("woooo222 " + currentIndex)
+        } else if (event.key == Qt.Key_Down && currentIndex > 0){
+            currentIndex = currentIndex - 1
+            console.log("woooo333 " + currentIndex)
+        }
+    }
+
 }