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 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);
+ signal checkFocus();
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
- id: rectangle1
- color: myPalette.base
- anchors.fill: parent
-
ElementsListView{
id: wordList
width: rectangle1.width
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{
id: wordListDelegate
Item {
+ onActiveFocusChanged: rectangle1.checkFocus();
+
width: rectangle1.width
height: {
if (wordText.height + 4 > check.height)
else
return check.height;
}
-
MouseArea{
anchors.fill: parent
- onClicked: {
- wordList.currentIndex = index// number
+ onClicked: wordList.currentIndex = index
+ onDoubleClicked: {
+ wordList.currentIndex = number
rectangle1.wordSelected(word)
}
}
pathToUncheckedImage: UncheckedPath
anchors.right: parent.right
anchors.rightMargin: 5
-
+ pathToCheckedDicImage: CheckedPath
+ pathToUncheckedDicImage: UncheckedPath
anchors.verticalCenter: parent.verticalCenter
onChanged: rectangle1.changeWordState(number, selected)
}
-
}
-
}
Text {
}
]
}
+
+ states: [
+ State {
+ name: "noFocus";
+ when: ((!wordList.focus) && (!rectangle1.focus))
+ PropertyChanges { target: wordList.highlightItem; opacity:0}
+ }
+ ]
}