Scroll to current item after search

This commit is contained in:
kateleet 2021-12-05 15:15:35 +08:00
parent bbd19e0410
commit 6ace2da599
3 changed files with 8 additions and 0 deletions

View file

@ -1339,6 +1339,8 @@ void FolderModel::keyboardSearch(const QString &text)
if (index >= 0) { if (index >= 0) {
clearSelection(); clearSelection();
setSelected(index); setSelected(index);
emit scrollToItem(index);
} }
} }

View file

@ -244,6 +244,7 @@ signals:
void filterMimeTypesChanged(); void filterMimeTypesChanged();
void selectedItemSizeChanged(); void selectedItemSizeChanged();
void showHiddenFilesChanged(); void showHiddenFilesChanged();
void scrollToItem(int index);
void notification(const QString &message); void notification(const QString &message);
void move(int x, int y, QList<QUrl> urls); void move(int x, int y, QList<QUrl> urls);

View file

@ -168,6 +168,11 @@ Item {
function onNotification(text) { function onNotification(text) {
root.showPassiveNotification(text, 3000) root.showPassiveNotification(text, 3000)
} }
// Scroll to item.
function onScrollToItem(index) {
_viewLoader.item.currentIndex = index
}
} }
FM.ItemViewAdapter { FM.ItemViewAdapter {