X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b60da9b67acbfe94e43bd631e4e685f366d53ec5..d2fbbd44b422cc64ad184886670ca22df9dced5b:/src/dolphincolumnwidget.cpp diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp index c552d70e1..41fad2ea7 100644 --- a/src/dolphincolumnwidget.cpp +++ b/src/dolphincolumnwidget.cpp @@ -55,6 +55,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent, m_active(true), m_view(columnView), m_selectionManager(0), + m_autoScroller(0), m_url(url), m_childUrl(), m_font(), @@ -77,8 +78,8 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent, setVerticalScrollMode(QListView::ScrollPerPixel); setHorizontalScrollMode(QListView::ScrollPerPixel); - - new DolphinViewAutoScroller(this); + + m_autoScroller = new DolphinViewAutoScroller(this); // apply the column mode settings to the widget const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); @@ -146,7 +147,7 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent, connect(KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), this, SLOT(updateFont())); - + FolderExpander* folderExpander = new FolderExpander(this, m_proxyModel); folderExpander->setEnabled(DolphinSettings::instance().generalSettings()->autoExpandFolders()); connect (folderExpander, SIGNAL(enterDir(const QModelIndex&)), @@ -421,7 +422,7 @@ void DolphinColumnWidget::wheelEvent(QWheelEvent* event) event->ignore(); return; } - + const int height = m_decorationSize.height(); const int step = (height >= KIconLoader::SizeHuge) ? height / 10 : (KIconLoader::SizeHuge - height) / 2; verticalScrollBar()->setSingleStep(step); @@ -447,6 +448,14 @@ void DolphinColumnWidget::selectionChanged(const QItemSelection& selected, const selModel->select(deselected, QItemSelectionModel::Deselect); } +void DolphinColumnWidget::currentChanged(const QModelIndex& current, const QModelIndex& previous) +{ + QListView::currentChanged(current, previous); + if (current.isValid() && !m_autoScroller->isActive()) { + scrollTo(current); + } +} + void DolphinColumnWidget::slotEntered(const QModelIndex& index) { m_view->m_controller->setItemView(this);