Change ExploreComponent to signal text changes and set filterText from there

This commit is contained in:
James Graham
2024-02-16 19:48:16 +00:00
parent 1b59917f16
commit 292cfb0d3d
2 changed files with 10 additions and 1 deletions

View File

@@ -66,13 +66,18 @@ RowLayout {
} }
} }
/**
* @brief Emitted when the text is changed in the search field.
*/
signal textChanged(string newText)
Kirigami.SearchField { Kirigami.SearchField {
Layout.topMargin: Kirigami.Units.smallSpacing Layout.topMargin: Kirigami.Units.smallSpacing
Layout.bottomMargin: Kirigami.Units.smallSpacing Layout.bottomMargin: Kirigami.Units.smallSpacing
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: root.desiredWidth ? root.desiredWidth - menuButton.width - root.spacing : -1 Layout.preferredWidth: root.desiredWidth ? root.desiredWidth - menuButton.width - root.spacing : -1
visible: !root.collapsed visible: !root.collapsed
onTextChanged: sortFilterRoomListModel.filterText = text onTextChanged: root.textChanged(text)
KeyNavigation.tab: listView KeyNavigation.tab: listView
} }

View File

@@ -402,6 +402,10 @@ Kirigami.Page {
desiredWidth: root.width - Kirigami.Units.largeSpacing desiredWidth: root.width - Kirigami.Units.largeSpacing
collapsed: root.collapsed collapsed: root.collapsed
connection: root.connection connection: root.connection
onTextChanged: newText => {
sortFilterRoomListModel.filterText = newText;
}
} }
} }