X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmdictionary%2Fqml%2FWordListWidget.qml;h=742cf498252b01b616c008c1e67014bdee7b6276;hb=ebd4c2c97364e18aae17e790155b8f4060981c37;hp=145ad895ecf56334a819cdfd2f97c471125792f5;hpb=08e403fb8f97d1352819f64d81eeda2c65148a40;p=mdictionary diff --git a/src/mdictionary/qml/WordListWidget.qml b/src/mdictionary/qml/WordListWidget.qml index 145ad89..742cf49 100644 --- a/src/mdictionary/qml/WordListWidget.qml +++ b/src/mdictionary/qml/WordListWidget.qml @@ -27,23 +27,22 @@ import Qt 4.7 Rectangle { function changeWordState(nr, state) { - console.log("LOOOOOL") wordList.currentIndex = nr wordModel.setModelProperty(wordList.currentIndex, state, "isBookmarked") + } + function changeWordStateByIndex() { + wordModel.setModelPropertyByIndex(wordList.currentIndex, "isBookmarked") } function setEnabled(Boolean) { wordList.enabled = Boolean } function setWordListEmpty(Boolean) { wordList.empty = Boolean } function setFocus() { - console.log("juhu") wordList.setFocus() -// activeFocus = true - console.log(focus + "a " + activeFocus) - console.log(wordList.focus + "b " + wordList.activeFocus) } signal wordSelected(string word); + signal wordSelectedByIndex(int nr); SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } @@ -59,8 +58,12 @@ Rectangle { highlightResizeSpeed: 1000 property bool empty: false - onCurrentIndexChanged: { - console.log("111!!!WTF " + currentIndex) + Keys.onPressed: { + if (event.key == Qt.Key_Space && currentIndex >= 0){ + rectangle1.changeWordStateByIndex(); + } else if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && currentIndex >= 0){ + rectangle1.wordSelectedByIndex(currentIndex) + } } delegate: Component{ @@ -77,7 +80,7 @@ Rectangle { MouseArea{ anchors.fill: parent onClicked: { - wordList.currentIndex = index// number + wordList.currentIndex = index rectangle1.wordSelected(word) } }