diff options
| author | Simon Paul St James <[email protected]> | 2008-10-26 17:25:14 +0000 |
|---|---|---|
| committer | Simon Paul St James <[email protected]> | 2008-10-26 17:25:14 +0000 |
| commit | 382ac5f01d1f12da5980ae6873aa21d9b4be6d9b (patch) | |
| tree | 0fbad27d37099bbd37de42caa99d939f60c3d6c5 /src/dolphindetailsview.cpp | |
| parent | 0d8aebb7ba7d3e717171ac4d12b0c3800a4739d1 (diff) | |
When restoring the index, we don't necessarily want to scroll to it.
BUG:165551
svn path=/trunk/KDE/kdebase/apps/; revision=876177
Diffstat (limited to 'src/dolphindetailsview.cpp')
| -rw-r--r-- | src/dolphindetailsview.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index 6563cb658..3ccca4622 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -55,7 +55,8 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr m_selectionManager(0), m_font(), m_decorationSize(), - m_band() + m_band(), + m_ignoreScrollTo(false) { const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); Q_ASSERT(settings != 0); @@ -228,9 +229,11 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event) clearSelection(); } - // restore the current index, other columns are handled as viewport area + // restore the current index, other columns are handled as viewport area. + // setCurrentIndex(...) implicitly calls scrollTo(...), which we want to ignore. + m_ignoreScrollTo = true; selectionModel()->setCurrentIndex(current, QItemSelectionModel::Current); - + m_ignoreScrollTo = false; if ((event->button() == Qt::LeftButton) && !m_expandingTogglePressed) { // Inform Qt about what we are doing - otherwise it starts dragging items around! @@ -466,6 +469,13 @@ void DolphinDetailsView::setSelection(const QRect &rect, QItemSelectionModel::Se } } +void DolphinDetailsView::scrollTo(const QModelIndex & index, ScrollHint hint) +{ + if (m_ignoreScrollTo) + return; + QTreeView::scrollTo(index, hint); +} + void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting) { QHeaderView* headerView = header(); |
