Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 0b130dd5 authored by Marco Martin's avatar Marco Martin

base scrolling on the smallest item

CCBUG: 386379

after recent highdpi patches on scrolling that delegated it
completely to the scrollbar, based upon the scrollbar singleStep
setted to the tallest of the items in the view.
tough this makes scrolling way too fast, and on folders where just
few filenames are longer than most we can get a single scrolling
step almost double the number of lines configured in the
mouse kcm.
Using the shortest item instead of the tallest mitigates this problem
making it a bit more usable

Test Plan:
tested on different folders in different view modes both with
mouse and touchpad

Reviewers: #dolphin, broulik, ngraham

Reviewed By: #dolphin, ngraham

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision:
parent 7caef6d2
......@@ -35,7 +35,6 @@
#include <QStyle>
#include <QStyleOption>
* Replaces the default viewport of KItemListContainer by a
* non-scrollable viewport. The scrolling is done in an optimized
......@@ -342,7 +342,7 @@ QSizeF KItemListView::itemSize() const
QSizeF KItemListView::itemSizeHint() const
return m_sizeHintResolver->maxSizeHint();
return m_sizeHintResolver->minSizeHint();
const KItemListStyleOption& KItemListView::styleOption() const
......@@ -26,6 +26,7 @@ KItemListSizeHintResolver::KItemListSizeHintResolver(const KItemListView* itemLi
......@@ -40,6 +41,12 @@ QSizeF KItemListSizeHintResolver::maxSizeHint()
return QSizeF(m_logicalWidthHint, m_logicalHeightHint);
QSizeF KItemListSizeHintResolver::minSizeHint()
return QSizeF(m_logicalWidthHint, m_minHeightHint);
QSizeF KItemListSizeHintResolver::sizeHint(int index)
......@@ -161,6 +168,7 @@ void KItemListSizeHintResolver::updateCache()
m_logicalHeightHint = 0.0;
} else {
m_logicalHeightHint = *std::max_element(m_logicalHeightHintCache.begin(), m_logicalHeightHintCache.end());
m_minHeightHint = *std::min_element(m_logicalHeightHintCache.begin(), m_logicalHeightHintCache.end());
m_needsResolving = false;
......@@ -37,6 +37,7 @@ public:
KItemListSizeHintResolver(const KItemListView* itemListView);
virtual ~KItemListSizeHintResolver();
QSizeF maxSizeHint();
QSizeF minSizeHint();
QSizeF sizeHint(int index);
void itemsInserted(const KItemRangeList& itemRanges);
......@@ -52,6 +53,7 @@ private:
mutable QVector<qreal> m_logicalHeightHintCache;
mutable qreal m_logicalWidthHint;
mutable qreal m_logicalHeightHint;
mutable qreal m_minHeightHint;
bool m_needsResolving;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment