┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphinviewautoscroller.cpp20
-rw-r--r--src/dolphinviewautoscroller.h1
2 files changed, 19 insertions, 2 deletions
diff --git a/src/dolphinviewautoscroller.cpp b/src/dolphinviewautoscroller.cpp
index ea9b1a2d6..cfd3543a5 100644
--- a/src/dolphinviewautoscroller.cpp
+++ b/src/dolphinviewautoscroller.cpp
@@ -31,6 +31,7 @@
DolphinViewAutoScroller::DolphinViewAutoScroller(QAbstractItemView* parent) :
QObject(parent),
m_rubberBandSelection(false),
+ m_keyPressed(false),
m_horizontalScrollInc(0),
m_verticalScrollInc(0),
m_itemView(parent),
@@ -38,6 +39,7 @@ DolphinViewAutoScroller::DolphinViewAutoScroller(QAbstractItemView* parent) :
{
m_itemView->setAutoScroll(false);
m_itemView->viewport()->installEventFilter(this);
+ m_itemView->installEventFilter(this);
m_timer = new QTimer(this);
m_timer->setSingleShot(false);
@@ -59,8 +61,9 @@ void DolphinViewAutoScroller::handleCurrentIndexChange(const QModelIndex& curren
{
// When the autoscroller is inactive and a key has been pressed, it must be
// assured that the current item stays visible. The check whether the previous
- // item is valid is important because of #197951.
- if (current.isValid() && previous.isValid() && !isActive()) {
+ // item is valid is important because of #197951. The keypress check is done
+ // because of #199833.
+ if (current.isValid() && (previous.isValid() || m_keyPressed) && !isActive()) {
m_itemView->scrollTo(current);
}
}
@@ -101,6 +104,19 @@ bool DolphinViewAutoScroller::eventFilter(QObject* watched, QEvent* event)
default:
break;
}
+ } else if (watched == m_itemView) {
+ switch (event->type()) {
+ case QEvent::KeyPress:
+ m_keyPressed = true;
+ break;
+
+ case QEvent::KeyRelease:
+ m_keyPressed = false;
+ break;
+
+ default:
+ break;
+ }
}
return QObject::eventFilter(watched, event);
diff --git a/src/dolphinviewautoscroller.h b/src/dolphinviewautoscroller.h
index c95155f58..a858d27cb 100644
--- a/src/dolphinviewautoscroller.h
+++ b/src/dolphinviewautoscroller.h
@@ -66,6 +66,7 @@ private:
private:
bool m_rubberBandSelection;
+ bool m_keyPressed;
int m_horizontalScrollInc;
int m_verticalScrollInc;
QAbstractItemView* m_itemView;