serachBar + progressBar
[mdictionary] / src / mdictionary / qml / SearchBarWidget.qml
index 64c0142..8bd574e 100644 (file)
@@ -2,15 +2,30 @@ import Qt 4.7
 
 Rectangle {
     id: searchBarWidget
-
     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
     color : myPalette.window;
 
+    property alias enableLineEdit: inputSearchText.enabled;
+
+    function setButtonText(string) { searchButton.setText(string) }
+    function setEnableHistoryPrev(Boolean) { historyPrevToolButton.enabled = Boolean }
+    function setEnableHistoryNext(Boolean) { historyNextToolButton.enabled = Boolean }
+    function setEnableHistoryShow(Boolean) { historyShowToolButton.enabled = Boolean }
+    function setEnableLineEdit(Boolean) { enableLineEdit = Boolean }
+    function setLineEditText(string) { inputSearchText.setText(string) }
+
+    signal searchButtonClicked(string text);
+    signal historyNextToolButtonClicked;
+    signal historyShowToolButtonClicked;
+    signal historyPrevToolButtonClicked;
+
     MyTextLineEdit{
         id: inputSearchText
         width: (searchBarWidget.width - (searchBarWidget.height*3.5 + searchButton.width + 9));
-        height: searchBarWidget.height
-        anchors.left: searchBarWidget.left
+        height: searchBarWidget.height -1;
+        anchors.left: parent.left
+        anchors.verticalCenter: parent.verticalCenter
+        onEnterPressed: searchBarWidget.searchButtonClicked(text);
         IconButton {
             id: clearButton;
             width:  inputSearchText.height-6;
@@ -19,7 +34,7 @@ Rectangle {
             anchors.right: parent.right
             anchors.verticalCenter: parent.verticalCenter
             enabled: true;
-            pathToIcon: "/home/jakub/go-previous.png";
+            pathToIcon: "qrc:/button/go-previous.png";
         }
     }
 
@@ -35,41 +50,45 @@ Rectangle {
             width: 100
             height: searchBarWidget.height;
             anchors.rightMargin: 3
-            anchors.right: historyButton3.left
+            anchors.right: historyPrevToolButton.left
             anchors.verticalCenter: parent.verticalCenter
             textInButton: "Search"
+            onClicked: searchBarWidget.searchButtonClicked(inputSearchText.textInLineEdit);
         }
 
         IconButton {
-            id: historyButton1;
+            id: historyNextToolButton;
             width:  searchBarWidget.height
             height: searchBarWidget.height
             anchors.right: parent.right
             anchors.verticalCenter: parent.verticalCenter
             enabled: true;
-            pathToIcon: "/home/jakub/go-previous.png";
+            pathToIcon: "qrc:/button/go-previous.png";
+            onClicked: searchBarWidget.historyNextToolButtonClicked();
         }
 
         IconButton {
-            id: historyButton2;
+            id: historyShowToolButton;
             width:  searchBarWidget.height
             height: searchBarWidget.height
             anchors.rightMargin: 3
-            anchors.right: historyButton1.left
+            anchors.right: historyNextToolButton.left
             anchors.verticalCenter: parent.verticalCenter
             enabled: true;
-            pathToIcon: "/home/jakub/go-previous.png";
+            pathToIcon: "qrc:/button/go-previous.png";
+            onClicked: searchBarWidget.historyShowToolButtonClicked();
         }
 
         IconButton {
-            id: historyButton3;
+            id: historyPrevToolButton;
             width:  searchBarWidget.height
             height: searchBarWidget.height
             anchors.rightMargin: 3
-            anchors.right: historyButton2.left
+            anchors.right: historyShowToolButton.left
             anchors.verticalCenter: parent.verticalCenter
             enabled: true;
-            pathToIcon: "/home/jakub/go-previous.png";
+            pathToIcon: "qrc:/button/go-previous.png";
+            onClicked: searchBarWidget.historyPrevToolButtonClicked();
         }
     }
 }