m_treeView->setModel(m_proxyModel);
m_proxyModel->setSorting(DolphinView::SortByName);
m_proxyModel->setSortOrder(Qt::AscendingOrder);
+ m_treeView->setAutoHorizontalScroll(FoldersPanelSettings::autoScrolling());
new FolderExpander(m_treeView, m_proxyModel);
connect(m_treeView, SIGNAL(pressed(const QModelIndex&)),
this, SLOT(updateMouseButtons()));
+ connect(m_treeView->horizontalScrollBar(), SIGNAL(sliderMoved(int)),
+ this, SLOT(slotHorizontalScrollBarMoved(int)));
+ connect(m_treeView->verticalScrollBar(), SIGNAL(sliderMoved(int)),
+ this, SLOT(slotVerticalScrollBarMoved(int)));
+
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->addWidget(m_treeView);
-
- setAutoScrolling(FoldersPanelSettings::autoScrolling());
- setShowHiddenFiles(FoldersPanelSettings::showHiddenFiles());
}
loadTree(url());
}
}
+void FoldersPanel::slotHorizontalScrollBarMoved(int value)
+{
+ Q_UNUSED(value);
+ // Disable the auto-scrolling until the vertical scrollbar has
+ // been moved by the user.
+ m_treeView->setAutoHorizontalScroll(false);
+}
+
+void FoldersPanel::slotVerticalScrollBarMoved(int value)
+{
+ Q_UNUSED(value);
+ // Enable the auto-scrolling again (it might have been disabled by
+ // moving the horizontal scrollbar).
+ m_treeView->setAutoHorizontalScroll(FoldersPanelSettings::autoScrolling());
+}
+
void FoldersPanel::loadTree(const KUrl& url)
{
Q_ASSERT(m_dirLister != 0);
{
}
-void KTreeView::setAutoHorizontalScroll(bool value)
+void KTreeView::setAutoHorizontalScroll(bool enable)
{
- d->autoHorizontalScroll = value;
+ d->autoHorizontalScroll = enable;
+ if (!enable) {
+ d->timeLine->stop();
+ }
}
bool KTreeView::autoHorizontalScroll() const
return d->autoHorizontalScroll;
}
-void KTreeView::setSelectionModel(QItemSelectionModel *selectionModel)
-{
- QTreeView::setSelectionModel(selectionModel);
- connect(selectionModel,
- SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
- this, SLOT(startScrolling()));
-}
-
void KTreeView::scrollTo(const QModelIndex& index, ScrollHint hint)
{
const int value = horizontalScrollBar()->value();
KTreeView(QWidget *parent = 0);
virtual ~KTreeView();
- void setAutoHorizontalScroll(bool value);
+ void setAutoHorizontalScroll(bool enable);
bool autoHorizontalScroll() const;
- virtual void setSelectionModel(QItemSelectionModel *selectionModel);
virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible);
protected: