X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fc97fa250d89c620a99d58d0a787a648d680fb31..13b2fc55704fbc734cd4f9cbae56cfc2ef3ec0ce:/src/ktreeview.cpp diff --git a/src/ktreeview.cpp b/src/ktreeview.cpp index 687bfe1e3..cb7560b20 100644 --- a/src/ktreeview.cpp +++ b/src/ktreeview.cpp @@ -36,7 +36,7 @@ KTreeView::KTreeViewPrivate::KTreeViewPrivate(KTreeView *parent) : { startScrollTimer = new QTimer(this); startScrollTimer->setSingleShot(true); - startScrollTimer->setInterval(50); + startScrollTimer->setInterval(300); connect(startScrollTimer, SIGNAL(timeout()), this, SLOT(startScrolling())); @@ -156,5 +156,18 @@ void KTreeView::setSelectionModel(QItemSelectionModel *selectionModel) d->startScrollTimer, SLOT(start())); } +void KTreeView::scrollTo(const QModelIndex& index, ScrollHint hint) +{ + if (d->autoHorizontalScroll) { + // assure that the value of the horizontal scrollbar stays on its current value, + // KTreeView will adjust the value manually + const int value = horizontalScrollBar()->value(); + QTreeView::scrollTo(index, hint); + horizontalScrollBar()->setValue(value); + } else { + QTreeView::scrollTo(index, hint); + } +} + #include "ktreeview.moc" #include "ktreeview_p.moc"