X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmdictionary%2Fqml%2FWordListWidget.qml;h=750f856f7119a3626e5f8afafcb46169806aa43d;hb=346a68ad33b6a6946fbee3993cfc7b3cb9e1690d;hp=15b01c6fc07bf28933f865f0fdefe6bfa2953fdf;hpb=ac86fa7a460e6fb10126eb63372d18a5dd1e1f4d;p=mdictionary diff --git a/src/mdictionary/qml/WordListWidget.qml b/src/mdictionary/qml/WordListWidget.qml index 15b01c6..750f856 100644 --- a/src/mdictionary/qml/WordListWidget.qml +++ b/src/mdictionary/qml/WordListWidget.qml @@ -1,6 +1,90 @@ import Qt 4.7 Rectangle { - width: 100 - height: 62 + + function changeWordState(nr, state) { + wordList.currentIndex = nr + wordModel.setModelProperty(wordList.currentIndex, state, "isBookmarked") + + } + +// function setEnabled(Boolean) { wordList.enabled = Boolean; println(wordList.enabled) } // slot + + signal wordSelected(string word); + //? +// signal addToBookmarks(int nr); +// signal removeFromBookmarks(int nr); + + SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } + + id: rectangle1 + color: myPalette.base + anchors.fill: parent + + ElementsListView{ + id: wordList + width: rectangle1.width +// height: rectangle1.height + anchors.fill: parent + highlightResizeSpeed: 1000 + + delegate: Component{ + id: wordListDelegate + Item { + width: rectangle1.width + height: { + if (wordText.height + 4 > check.height) + return wordText.height + 4; + else + return check.height; + } + Row { + anchors.fill: parent + + Text { + id: wordText + text: + { + if (word == "!@#$%"){ + qsTr("Can't find any matching words") + } else { + word + } + } + + MouseArea{ + anchors.fill: parent + onClicked: { + wordList.currentIndex = number + console.log("lolol") + rectangle1.wordSelected(word) + } + } + } + + Checkbox{ + id: check + width: wordText.height + selected: isBookmarked + pathToCheckedImage: CheckedPath + pathToUncheckedImage: UncheckedPath + anchors.leftMargin: 5 + anchors.verticalCenter: parent.verticalCenter + onChanged: rectangle1.changeWordState(number, selected) + visible: { + if (word == "!@#$%"){ + false + } else { + true + } + } + } + + } + } + + } + + model: wordModel + } }