From a34d93e920d82817a01667ed687cebe96d68f1e7 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 10 Jan 2025 00:17:10 +0100 Subject: [PATCH] Remember scrolling position when navigating though file browser --- tray/gui/qml/FilesPage.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tray/gui/qml/FilesPage.qml b/tray/gui/qml/FilesPage.qml index 161cfddb..734af135 100644 --- a/tray/gui/qml/FilesPage.qml +++ b/tray/gui/qml/FilesPage.qml @@ -49,6 +49,7 @@ Page { const modelIndex = delegateModel.modelIndex(index); if (delegateModel.model.hasChildren(modelIndex)) { delegateModel.rootIndex = modelIndex; + listView.positionViewAtBeginning(); } else { itemDelegate.toggle(); } @@ -156,9 +157,12 @@ Page { property var extraActions: [] function back() { - const isValid = delegateModel.rootIndex.valid; + const rootIndex = delegateModel.rootIndex; + const isValid = rootIndex.valid; if (isValid) { + const parentRow = rootIndex.row; delegateModel.rootIndex = delegateModel.parentModelIndex(); + listView.positionViewAtIndex(parentRow, ListView.Center); } return isValid; }