Commit ddd99df3 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

emojier: Put the search field on the toolbar

It blends better on the UX, works just as well.
parent cb7c6c77
......@@ -32,33 +32,43 @@ Kirigami.ScrollablePage
leftPadding: 0
rightPadding: 0
header: QQC2.TextField {
id: searchField
Layout.fillWidth: true
placeholderText: i18n("Search...")
onTextChanged: {
emojiModel.search = text
if (emojiView.currentIndex < 0) {
emojiView.currentIndex = 0
}
}
onAccepted: {
if (emojiView.currentItem)
emojiView.currentItem.reportEmoji()
}
height: visible ? implicitHeight : 0
visible: false
Keys.onEscapePressed: visible = false
}
actions.main: Kirigami.Action {
checked: searchField.visible
icon.name: "search"
tooltip: i18n("Search...")
shortcut: StandardKey.Find
onTriggered: {
searchField.visible = !searchField.visible
searchField.focus = searchField.visible
checked = !checked
}
}
titleDelegate: RowLayout {
Layout.fillWidth: true
Layout.preferredWidth: view.width
Kirigami.Heading {
text: view.title
Layout.fillWidth: true
}
QQC2.TextField {
id: searchField
Layout.fillWidth: true
placeholderText: i18n("Search...")
onTextChanged: {
emojiModel.search = text
if (emojiView.currentIndex < 0) {
emojiView.currentIndex = 0
}
}
onAccepted: {
if (emojiView.currentItem)
emojiView.currentItem.reportEmoji()
}
visible: view.actions.main.checked
onVisibleChanged: if (visible) forceActiveFocus()
Keys.onEscapePressed: {
text = ""
view.actions.main.checked = false
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment