diff options
| author | Elvis Angelaccio <[email protected]> | 2016-11-20 12:21:29 +0100 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2016-11-20 12:59:51 +0100 |
| commit | 90beb4a5e37b887caad1e767046a42dad0af1ab3 (patch) | |
| tree | 27ec05401c5eff1038d41fe1e1092338c0fc9e19 /src/kitemviews/private/kitemlistsizehintresolver.cpp | |
| parent | 3187c511c4aea82b954915387567d0d4e88f124e (diff) | |
Fix slow scrolling in dock panels
Commit f688bcd1f1 fixed slow scrolling with xf86-input-libinput on DolphinView.
However the commit also exposed a bug in the Dolphin scrolling
algorithm, which was previously hidden. This resulted in slow
scrolling in dock panels (Places and Folders), with both
xf86-input-evdev and xf86-input-libinput drivers, as well as libinput on
Wayland.
KItemListContainer::updateScrollOffsetScrollBar() relied on the view's
itemSize() method to compute the scrollbar's singleStep, but this QSize
was invalid for the dock panels' views.
We use a new itemSizeHint() method instead, which is always valid and
also adapts to the current icon size set in the view.
BUG: 365968
FIXED-IN: 16.12.0
REVIEW: 129409
Diffstat (limited to 'src/kitemviews/private/kitemlistsizehintresolver.cpp')
| -rw-r--r-- | src/kitemviews/private/kitemlistsizehintresolver.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistsizehintresolver.cpp b/src/kitemviews/private/kitemlistsizehintresolver.cpp index 1d8067026..02f1865b3 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.cpp +++ b/src/kitemviews/private/kitemlistsizehintresolver.cpp @@ -25,6 +25,7 @@ KItemListSizeHintResolver::KItemListSizeHintResolver(const KItemListView* itemLi m_itemListView(itemListView), m_logicalHeightHintCache(), m_logicalWidthHint(0.0), + m_logicalHeightHint(0.0), m_needsResolving(false) { } @@ -33,6 +34,12 @@ KItemListSizeHintResolver::~KItemListSizeHintResolver() { } +QSizeF KItemListSizeHintResolver::maxSizeHint() +{ + updateCache(); + return QSizeF(m_logicalWidthHint, m_logicalHeightHint); +} + QSizeF KItemListSizeHintResolver::sizeHint(int index) { updateCache(); @@ -149,6 +156,12 @@ void KItemListSizeHintResolver::updateCache() { if (m_needsResolving) { m_itemListView->calculateItemSizeHints(m_logicalHeightHintCache, m_logicalWidthHint); + // Set logical height as the max cached height (if the cache is not empty). + if (m_logicalHeightHintCache.isEmpty()) { + m_logicalHeightHint = 0.0; + } else { + m_logicalHeightHint = *std::max_element(m_logicalHeightHintCache.begin(), m_logicalHeightHintCache.end()); + } m_needsResolving = false; } } |
