some change
[mdictionary] / src / mdictionary / qml / WordListWidget.qml
index 288cbaf..9383549 100644 (file)
@@ -25,6 +25,9 @@
 import Qt 4.7
 
 Rectangle {
+    id: rectangle1
+    color: myPalette.base
+    anchors.fill: parent
 
     function changeWordState(nr, state) {
         wordList.currentIndex = nr
@@ -35,14 +38,10 @@ Rectangle {
     function setEnabled(Boolean) { wordList.enabled = Boolean }  // slot
 
     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
@@ -53,6 +52,8 @@ Rectangle {
         delegate: Component{
             id: wordListDelegate
             Item {
+                onActiveFocusChanged: rectangle1.checkFocus();
+
                 width: rectangle1.width
                 height: {
                     if (wordText.height + 4 > check.height)
@@ -60,10 +61,10 @@ Rectangle {
                     else
                             return check.height;
                 }
-
                 MouseArea{
                     anchors.fill: parent
-                    onClicked: {
+                    onClicked: wordList.currentIndex = number
+                    onDoubleClicked: {
                         wordList.currentIndex = number
                         rectangle1.wordSelected(word)
                     }
@@ -103,11 +104,17 @@ Rectangle {
                         }
                     }
                 }
-
             }
-
         }
 
         model: wordModel
     }
+
+    states: [
+            State {
+                name: "noFocus";
+                when: ((!wordList.focus) && (!rectangle1.focus))
+                PropertyChanges { target: wordList.highlightItem; opacity:0}
+           }
+    ]
 }