Skip to content

Commit

Permalink
Move search field to toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Nov 2, 2020
1 parent 5e690ed commit 0f83b05
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
21 changes: 8 additions & 13 deletions src/gui-qml/src/components/SearchField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,23 @@ FocusScope {

activeFocusOnTab: true

Rectangle {
anchors.fill: editbg
radius: editbg.radius
color: "#aaffffff"
anchors.bottomMargin: -1
}

Rectangle {
id: editbg
anchors.fill: parent
border.width: 1
border.color: "#ccc"
anchors.topMargin: 8
anchors.bottomMargin: 8
color: Qt.rgba(1, 1, 1, 0.6)
radius: 12

TextEdit {
id: textInput

anchors.fill: parent
clip: true
anchors.leftMargin: 16
anchors.rightMargin: 16
anchors.leftMargin: 12
anchors.rightMargin: 12
verticalAlignment: Text.AlignVCenter
font.pixelSize: 13
font.pixelSize: 14
focus: true

Keys.onEnterPressed: {
Expand All @@ -52,7 +47,7 @@ FocusScope {
verticalAlignment: Text.AlignVCenter
visible: !(parent.text.length || textInput.inputMethodComposing)
font: parent.font
color: "#aaa"
color: "#666"
}
}

Expand Down
46 changes: 13 additions & 33 deletions src/gui-qml/src/components/SearchScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@ Page {
onClicked: drawer.open()
}

Label {
text: qsTr("Search")
elide: Label.ElideRight
verticalAlignment: Qt.AlignVCenter
SearchField {
id: textFieldSearch

text: ""
placeholderText: qsTr("Search...")
Layout.fillWidth: true
Layout.fillHeight: true

onEnterPressed: searchTab.load()
}

ToolButton {
icon.source: "/images/icons/search.png"
onClicked: searchTab.load()
}
}
}
Expand All @@ -56,35 +65,6 @@ Page {
spacing: 0
anchors.fill: parent

RowLayout {
spacing: 0
Layout.fillWidth: true
Layout.fillHeight: false

SearchField {
id: textFieldSearch

text: ""
placeholderText: qsTr("Search...")
Layout.fillHeight: true
Layout.fillWidth: true

onEnterPressed: searchTab.load()
}

Button {
id: searchButton

width: 40
background.anchors.fill: searchButton
text: qsTr("Go")
Layout.fillHeight: true
Material.elevation: 0

onClicked: searchTab.load()
}
}

ScrollView {
Layout.fillHeight: true
Layout.fillWidth: true
Expand Down

0 comments on commit 0f83b05

Please sign in to comment.