mirror of
https://github.com/RGBCube/serenity
synced 2025-07-07 11:47:36 +00:00
LibGUI: Implement searching/jumping as you type in views
This allows the user to start typing and highlighting and jumping to a match in ColumnsView, IconView, TableView and TreeView if the model supports it.
This commit is contained in:
parent
307f0bc778
commit
52a847a0eb
13 changed files with 244 additions and 19 deletions
|
@ -119,4 +119,17 @@ ModelIndex FilteringProxyModel::map(const ModelIndex& index) const
|
|||
return {};
|
||||
}
|
||||
|
||||
bool FilteringProxyModel::is_searchable() const
|
||||
{
|
||||
return m_model.is_searchable();
|
||||
}
|
||||
|
||||
Vector<ModelIndex, 1> FilteringProxyModel::matches(const StringView& searching, unsigned flags, const ModelIndex& index)
|
||||
{
|
||||
auto found_indexes = m_model.matches(searching, flags, index);
|
||||
for (size_t i = 0; i < found_indexes.size(); i++)
|
||||
found_indexes[i] = map(found_indexes[i]);
|
||||
return found_indexes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue