serachBar + progressBar
[mdictionary] / src / mdictionary / qml / MyTextLineEdit.qml
index 7093c02..1c551a5 100644 (file)
@@ -4,6 +4,11 @@ Rectangle {
     id: rectangle1
     radius: 10
     border.color: "#000666";
+    property alias textInLineEdit:text_input1.text
+
+    signal enterPressed(string text);
+
+    function setText(string) { textInLineEdit = string; }
 
     TextInput {
         id: text_input1
@@ -15,5 +20,34 @@ Rectangle {
         selectByMouse: true;
         font.pixelSize: rectangle1.height * .5;
         onCursorPositionChanged:  moveCursorSelection(cursorPosition);
+        activeFocusOnPress: true;
+        Keys.onPressed: {
+            if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
+                rectangle1.enterPressed(text_input1.text)
+        }
     }
+
+    Rectangle {
+        id: shadeDisable
+        anchors.centerIn: parent;
+        radius: parent.radius
+        color: "grey";
+        opacity: 0
+        width:  parent.width;
+        height: parent.height;
+    }
+
+    states: [
+        State {
+            name: "FokusState"; when: text_input1.focus==true && rectangle1.enabled==true;
+            PropertyChanges {
+                target: rectangle1
+                border.width: 3
+            }
+        },
+        State {
+            name: "DisableState"; when: rectangle1.enabled==false;
+            PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }
+        }
+    ]
 }