serachBar + progressBar
[mdictionary] / src / mdictionary / qml / SearchBarWidget.qml
1 import Qt 4.7
2
3 Rectangle {
4     id: searchBarWidget
5     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
6     color : myPalette.window;
7
8     property alias enableLineEdit: inputSearchText.enabled;
9
10     function setButtonText(string) { searchButton.setText(string) }
11     function setEnableHistoryPrev(Boolean) { historyPrevToolButton.enabled = Boolean }
12     function setEnableHistoryNext(Boolean) { historyNextToolButton.enabled = Boolean }
13     function setEnableHistoryShow(Boolean) { historyShowToolButton.enabled = Boolean }
14     function setEnableLineEdit(Boolean) { enableLineEdit = Boolean }
15     function setLineEditText(string) { inputSearchText.setText(string) }
16
17     signal searchButtonClicked(string text);
18     signal historyNextToolButtonClicked;
19     signal historyShowToolButtonClicked;
20     signal historyPrevToolButtonClicked;
21
22     MyTextLineEdit{
23         id: inputSearchText
24         width: (searchBarWidget.width - (searchBarWidget.height*3.5 + searchButton.width + 9));
25         height: searchBarWidget.height -1;
26         anchors.left: parent.left
27         anchors.verticalCenter: parent.verticalCenter
28         onEnterPressed: searchBarWidget.searchButtonClicked(text);
29         IconButton {
30             id: clearButton;
31             width:  inputSearchText.height-6;
32             height: inputSearchText.height-6;
33             anchors.rightMargin: 4
34             anchors.right: parent.right
35             anchors.verticalCenter: parent.verticalCenter
36             enabled: true;
37             pathToIcon: "qrc:/button/go-previous.png";
38         }
39     }
40
41     Item {
42         id: buttonsBox
43         width: searchBarWidget.height*3.5 + searchButton.width + 9
44         height: searchBarWidget.height
45         anchors.right: parent.right
46         anchors.verticalCenter: parent.verticalCenter
47
48         Button {
49             id: searchButton
50             width: 100
51             height: searchBarWidget.height;
52             anchors.rightMargin: 3
53             anchors.right: historyPrevToolButton.left
54             anchors.verticalCenter: parent.verticalCenter
55             textInButton: "Search"
56             onClicked: searchBarWidget.searchButtonClicked(inputSearchText.textInLineEdit);
57         }
58
59         IconButton {
60             id: historyNextToolButton;
61             width:  searchBarWidget.height
62             height: searchBarWidget.height
63             anchors.right: parent.right
64             anchors.verticalCenter: parent.verticalCenter
65             enabled: true;
66             pathToIcon: "qrc:/button/go-previous.png";
67             onClicked: searchBarWidget.historyNextToolButtonClicked();
68         }
69
70         IconButton {
71             id: historyShowToolButton;
72             width:  searchBarWidget.height
73             height: searchBarWidget.height
74             anchors.rightMargin: 3
75             anchors.right: historyNextToolButton.left
76             anchors.verticalCenter: parent.verticalCenter
77             enabled: true;
78             pathToIcon: "qrc:/button/go-previous.png";
79             onClicked: searchBarWidget.historyShowToolButtonClicked();
80         }
81
82         IconButton {
83             id: historyPrevToolButton;
84             width:  searchBarWidget.height
85             height: searchBarWidget.height
86             anchors.rightMargin: 3
87             anchors.right: historyShowToolButton.left
88             anchors.verticalCenter: parent.verticalCenter
89             enabled: true;
90             pathToIcon: "qrc:/button/go-previous.png";
91             onClicked: searchBarWidget.historyPrevToolButtonClicked();
92         }
93     }
94 }