From: jakub Date: Mon, 28 Feb 2011 14:23:49 +0000 (+0100) Subject: Merge branch 'qml' X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=29aa1caa7c232b517244c11463844a7b54fed22d;hp=-c;p=mdictionary Merge branch 'qml' Conflicts: src/mdictionary/qml/WordListWidget.qml --- 29aa1caa7c232b517244c11463844a7b54fed22d diff --combined src/mdictionary/qml/WordListWidget.qml index 145ad89,9383549..f7e49f6 --- a/src/mdictionary/qml/WordListWidget.qml +++ b/src/mdictionary/qml/WordListWidget.qml @@@ -25,47 -25,35 +25,49 @@@ import Qt 4.7 Rectangle { + id: rectangle1 + color: myPalette.base + anchors.fill: parent function changeWordState(nr, state) { + console.log("LOOOOOL") wordList.currentIndex = nr wordModel.setModelProperty(wordList.currentIndex, state, "isBookmarked") } - function setEnabled(Boolean) { wordList.enabled = Boolean } // slot + 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 checkFocus(); SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } - id: rectangle1 - color: myPalette.base - anchors.fill: parent - ElementsListView{ id: wordList width: rectangle1.width anchors.fill: parent highlightResizeSpeed: 1000 + property bool empty: false + + onCurrentIndexChanged: { + console.log("111!!!WTF " + currentIndex) + } delegate: Component{ id: wordListDelegate Item { + onActiveFocusChanged: rectangle1.checkFocus(); + width: rectangle1.width height: { if (wordText.height + 4 > check.height) @@@ -73,11 -61,11 +75,11 @@@ else return check.height; } - MouseArea{ anchors.fill: parent - onClicked: { - wordList.currentIndex = index// number - onClicked: wordList.currentIndex = number ++ onClicked: wordList.currentIndex = index + onDoubleClicked: { + wordList.currentIndex = number rectangle1.wordSelected(word) } } @@@ -86,7 -74,14 +88,7 @@@ Text { id: wordText anchors.verticalCenter: parent.verticalCenter - text: - { - if (word == "!@#$%"){ - qsTr("Can't find any matching words") - } else { - word - } - } + text: word } Checkbox{ @@@ -97,54 -92,29 +99,61 @@@ pathToUncheckedImage: UncheckedPath anchors.right: parent.right anchors.rightMargin: 5 - + pathToCheckedDicImage: CheckedPath + pathToUncheckedDicImage: UncheckedPath anchors.verticalCenter: parent.verticalCenter onChanged: rectangle1.changeWordState(number, selected) - visible: { - if (word == "!@#$%"){ - false - } else { - true - } - } } - } - } + Text { + id: emptyText + anchors.top: parent.top + anchors.left: parent.left + text: qsTr("Can't find any matching words") + } + + Rectangle { + id: shadeDisable + anchors.centerIn: parent; + color: "grey"; + opacity: 0 + width: parent.width; + height: parent.height; + } + model: wordModel + + states: [ + State { + name: "empty" + when: (wordList.empty == true); + PropertyChanges { target: emptyText; visible: true} + }, + State { + name: "non-empty" + when: (wordList.empty == false); + PropertyChanges { target: emptyText; visible: false} + }, + State { + name: "enabled" + when: (wordList.enabled == true); + PropertyChanges { target: shadeDisable; z: 30; opacity: 0.5 } + }, + State { + name: "disabled" + when: (wordList.enabled == false); + PropertyChanges { target: shadeDisable; z: 30; opacity: 0.0 } + } + ] } + + states: [ + State { + name: "noFocus"; + when: ((!wordList.focus) && (!rectangle1.focus)) + PropertyChanges { target: wordList.highlightItem; opacity:0} + } + ] }