diff options
| author | Nate Graham <[email protected]> | 2019-02-20 10:05:06 -0700 |
|---|---|---|
| committer | Nate Graham <[email protected]> | 2019-12-21 11:54:46 -0700 |
| commit | 403de19d9c036dd28481d3b62bdb0f49f0792fbf (patch) | |
| tree | ea90be44a8dbe339ff92f8255ceac2c1457e4168 /src/kitemviews/kitemlistcontainer.cpp | |
| parent | 588965feccdc38c8bf2ec0e1a25b8d195c451062 (diff) | |
Improve scroll wheel speed by basing it on label height, not icon height
Summary:
Dolphin currently scrolls by the height of three items at a time per "step" when
using a scroll wheel. Because item height is highly variable, this leads to scroll
speed being inconsistent between views, and generally far too fast when using
icon view with icons larger than 22px size.
This patch makes the size of the scroll step based on the text label rather than the
icon size just like D25683, ensuring that the scroll speed does not vary and become
super fast when using large icons in particular.
It also reverts 90beb4a5e37b887caad1e767046a42dad0af1ab3, which is no longer needed.
BUG: 386379
FIXED-IN: 19.12.1
Test Plan:
Use a mouse with a scroll wheel and scroll in Dolphin item views with list view,
details view, icon view, etc, using different item sizes. Speed should be
consistent in all views now, and also feel consistent with other KDE apps.
Also try with multiple scale factors to make sure the behavior does not change.
No change with high-resolution two-finger touchpad scrolling.
Reviewers: #dolphin, elvisangelaccio
Reviewed By: #dolphin, elvisangelaccio
Subscribers: ahiemstra, lots0logs, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19190
Diffstat (limited to 'src/kitemviews/kitemlistcontainer.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistcontainer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index 2deba5466..b274e75e2 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -27,6 +27,7 @@ #include "private/kitemlistsmoothscroller.h" #include <QApplication> +#include <QFontMetrics> #include <QGraphicsScene> #include <QGraphicsView> #include <QScrollBar> @@ -261,7 +262,14 @@ void KItemListContainer::updateScrollOffsetScrollBar() if (view->scrollOrientation() == Qt::Vertical) { smoothScroller = m_verticalSmoothScroller; scrollOffsetScrollBar = verticalScrollBar(); - singleStep = view->itemSizeHint().height(); + + // Don't scroll super fast when using a wheel mouse: + // We want to consider one "line" to be the text label which has a + // roughly fixed height rather than using the height of the icon which + // may be very tall + const QFontMetrics metrics(font()); + singleStep = metrics.height() * QApplication::wheelScrollLines(); + // We cannot use view->size().height() because this height might // include the header widget, which is not part of the scrolled area. pageStep = view->verticalPageStep(); |
