┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ktreeview.cpp15
-rw-r--r--src/ktreeview.h1
2 files changed, 15 insertions, 1 deletions
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"
diff --git a/src/ktreeview.h b/src/ktreeview.h
index 4a6262621..0e9841fb3 100644
--- a/src/ktreeview.h
+++ b/src/ktreeview.h
@@ -35,6 +35,7 @@ public:
bool autoHorizontalScroll() const;
virtual void setSelectionModel(QItemSelectionModel *selectionModel);
+ virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible);
private:
class KTreeViewPrivate;