BUG: 165531
svn path=/trunk/KDE/kdebase/apps/; revision=895599
{
m_itemView->setAutoScroll(false);
m_itemView->viewport()->installEventFilter(this);
{
m_itemView->setAutoScroll(false);
m_itemView->viewport()->installEventFilter(this);
+ m_itemView->installEventFilter(this);
m_timer = new QTimer(this);
m_timer->setSingleShot(false);
m_timer = new QTimer(this);
m_timer->setSingleShot(false);
+ } else if ((watched == m_itemView) && (event->type() == QEvent::KeyPress)) {
+ const int key = static_cast<QKeyEvent*>(event)->key();
+ const bool arrowKeyPressed = (key == Qt::Key_Up) || (key == Qt::Key_Down) ||
+ (key == Qt::Key_Left) || (key == Qt::Key_Right);
+ if (arrowKeyPressed) {
+ QMetaObject::invokeMethod(this, "scrollToCurrentIndex", Qt::QueuedConnection);
+ }
+ }
+
return QObject::eventFilter(watched, event);
}
return QObject::eventFilter(watched, event);
}
+void DolphinViewAutoScroller::scrollToCurrentIndex()
+{
+ const QModelIndex index = m_itemView->currentIndex();
+ m_itemView->scrollTo(index);
+}
+
void DolphinViewAutoScroller::triggerAutoScroll()
{
const bool verticalScrolling = (m_itemView->verticalScrollBar() != 0) &&
void DolphinViewAutoScroller::triggerAutoScroll()
{
const bool verticalScrolling = (m_itemView->verticalScrollBar() != 0) &&
private slots:
void scrollViewport();
private slots:
void scrollViewport();
+ void scrollToCurrentIndex();
private:
void triggerAutoScroll();
private:
void triggerAutoScroll();