Commit 691a8210 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(SearchBox): create `_filter` function

parent a1f33b42
...@@ -44,6 +44,18 @@ Item { ...@@ -44,6 +44,18 @@ Item {
_isOpen = true _isOpen = true
} }
function _filter (text) {
console.assert(
model.setFilterFixedString != null,
'`model.setFilterFixedString` must be defined.'
)
model.setFilterFixedString(text)
if (model.invalidate) {
model.invalidate()
}
}
// ----------------------------------------------------------------- // -----------------------------------------------------------------
implicitHeight: searchField.height implicitHeight: searchField.height
...@@ -63,18 +75,7 @@ Item { ...@@ -63,18 +75,7 @@ Item {
Keys.onEscapePressed: searchBox.hideMenu() Keys.onEscapePressed: searchBox.hideMenu()
onActiveFocusChanged: activeFocus && searchBox.showMenu() onActiveFocusChanged: activeFocus && searchBox.showMenu()
onTextChanged: { onTextChanged: _filter()
console.assert(
model.setFilterFixedString != null,
'`model.setFilterFixedString` must be defined.'
)
model.setFilterFixedString(text)
if (model.invalidate) {
model.invalidate()
}
}
} }
// Wrap the search box menu in a window. // Wrap the search box menu in a window.
......
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