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
+ }
}