qml
[mdictionary] / src / mdictionary / qml / SearchBarWidget.qml
index 8bd574e..d72e71c 100644 (file)
@@ -13,6 +13,7 @@ Rectangle {
     function setEnableHistoryShow(Boolean) { historyShowToolButton.enabled = Boolean }
     function setEnableLineEdit(Boolean) { enableLineEdit = Boolean }
     function setLineEditText(string) { inputSearchText.setText(string) }
+    function clear() { inputSearchText.setText("") }
 
     signal searchButtonClicked(string text);
     signal historyNextToolButtonClicked;
@@ -26,6 +27,7 @@ Rectangle {
         anchors.left: parent.left
         anchors.verticalCenter: parent.verticalCenter
         onEnterPressed: searchBarWidget.searchButtonClicked(text);
+        focus: searchBarWidget.focus
         IconButton {
             id: clearButton;
             width:  inputSearchText.height-6;
@@ -35,6 +37,7 @@ Rectangle {
             anchors.verticalCenter: parent.verticalCenter
             enabled: true;
             pathToIcon: "qrc:/button/go-previous.png";
+            onClicked: clear();
         }
     }