diff options
| author | Peter Penz <[email protected]> | 2008-05-07 06:11:54 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-05-07 06:11:54 +0000 |
| commit | f2873a9738299c3d149b12b2dab5c57139e9a716 (patch) | |
| tree | 963196bc6e8baf293b2edec2e63af3145816c64b /src | |
| parent | aa8948e4910fca2003851356c8d6194864ad44e5 (diff) | |
enable the scrollTo() functionality if it has been triggered by a key-press
svn path=/trunk/KDE/kdebase/apps/; revision=804928
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphiniconsview.cpp | 17 | ||||
| -rw-r--r-- | src/dolphiniconsview.h | 1 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index f763c5476..d30012d45 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -40,6 +40,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) : KCategorizedView(parent), + m_enableScrollTo(false), m_controller(controller), m_selectionManager(0), m_categoryDrawer(0), @@ -137,12 +138,15 @@ DolphinIconsView::~DolphinIconsView() void DolphinIconsView::scrollTo(const QModelIndex& index, ScrollHint hint) { - Q_UNUSED(index); - Q_UNUSED(hint); - // Disable the QListView implementation of scrollTo(), as QAbstractItemView - // wants to scroll to the current index each time the layout has been changed. - // This becomes an issue when previews are loaded and the scrollbar is used: the - // scrollbar will always be reset to 0 on each new preview. + // Enable the QListView implementation of scrollTo() only if it has been + // triggered by a key press. Otherwise QAbstractItemView wants to scroll to the current + // index each time the layout has been changed. This becomes an issue when + // previews are loaded and the scrollbar is used: the scrollbar will always + // be reset to 0 on each new preview. + if (m_enableScrollTo) { + KCategorizedView::scrollTo(index, hint); + m_enableScrollTo = false; + } } void DolphinIconsView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) @@ -264,6 +268,7 @@ void DolphinIconsView::keyPressEvent(QKeyEvent* event) { KCategorizedView::keyPressEvent(event); m_controller->handleKeyPressEvent(event); + m_enableScrollTo = true; // see DolphinIconsView::scrollTo() } void DolphinIconsView::wheelEvent(QWheelEvent* event) diff --git a/src/dolphiniconsview.h b/src/dolphiniconsview.h index a05d7ae27..83672d2f5 100644 --- a/src/dolphiniconsview.h +++ b/src/dolphiniconsview.h @@ -98,6 +98,7 @@ private: int additionalInfoCount() const; private: + bool m_enableScrollTo; DolphinController* m_controller; SelectionManager* m_selectionManager; DolphinCategoryDrawer* m_categoryDrawer; |
