From 57a341635f5a942893786ebea5e942f3c515d55a Mon Sep 17 00:00:00 2001 From: Lukas Hrazky Date: Sun, 22 Aug 2010 22:45:03 +0200 Subject: [PATCH] remember scrollbar position for visited directories Signed-off-by: Lukas Hrazky --- src/filelist.cpp | 3 +++ src/filelist.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/filelist.cpp b/src/filelist.cpp index fe281b8..3cbe475 100644 --- a/src/filelist.cpp +++ b/src/filelist.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -65,8 +66,10 @@ bool FileList::changePath(QString path) { path = unwindPath(path); QDir dir(fileSystemModel->rootPath()); if (dir.cd(path)) { + scrollBarPosition[fileSystemModel->rootPath()] = verticalScrollBar()->value(); setRootIndex(fileSystemModel->setRootPath(dir.absolutePath())); clearSelection(); + verticalScrollBar()->setValue(scrollBarPosition[dir.absolutePath()]); emit pathChanged(fileSystemModel->rootPath()); return true; } diff --git a/src/filelist.h b/src/filelist.h index ec51cbc..8fd54ac 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -49,6 +49,8 @@ protected: void mousePressEvent(QMouseEvent *event); virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, const QEvent *event = 0) const; + QMap scrollBarPosition; + private slots: void activateItem(QModelIndex index); }; -- 1.7.9.5