Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kitemlistcontainer.cpp
Show All 21 Lines | |||||
22 | 22 | | |||
23 | #include "kitemlistcontainer.h" | 23 | #include "kitemlistcontainer.h" | ||
24 | 24 | | |||
25 | #include "kitemlistcontroller.h" | 25 | #include "kitemlistcontroller.h" | ||
26 | #include "kitemlistview.h" | 26 | #include "kitemlistview.h" | ||
27 | #include "private/kitemlistsmoothscroller.h" | 27 | #include "private/kitemlistsmoothscroller.h" | ||
28 | 28 | | |||
29 | #include <QApplication> | 29 | #include <QApplication> | ||
30 | #include <QFontMetrics> | ||||
30 | #include <QGraphicsScene> | 31 | #include <QGraphicsScene> | ||
31 | #include <QGraphicsView> | 32 | #include <QGraphicsView> | ||
32 | #include <QScrollBar> | 33 | #include <QScrollBar> | ||
33 | #include <QStyleOption> | 34 | #include <QStyleOption> | ||
34 | 35 | | |||
35 | /** | 36 | /** | ||
36 | * Replaces the default viewport of KItemListContainer by a | 37 | * Replaces the default viewport of KItemListContainer by a | ||
37 | * non-scrollable viewport. The scrolling is done in an optimized | 38 | * non-scrollable viewport. The scrolling is done in an optimized | ||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Line(s) | 251 | { | |||
256 | KItemListSmoothScroller* smoothScroller = nullptr; | 257 | KItemListSmoothScroller* smoothScroller = nullptr; | ||
257 | QScrollBar* scrollOffsetScrollBar = nullptr; | 258 | QScrollBar* scrollOffsetScrollBar = nullptr; | ||
258 | int singleStep = 0; | 259 | int singleStep = 0; | ||
259 | int pageStep = 0; | 260 | int pageStep = 0; | ||
260 | int maximum = 0; | 261 | int maximum = 0; | ||
261 | if (view->scrollOrientation() == Qt::Vertical) { | 262 | if (view->scrollOrientation() == Qt::Vertical) { | ||
262 | smoothScroller = m_verticalSmoothScroller; | 263 | smoothScroller = m_verticalSmoothScroller; | ||
263 | scrollOffsetScrollBar = verticalScrollBar(); | 264 | scrollOffsetScrollBar = verticalScrollBar(); | ||
264 | singleStep = view->itemSizeHint().height(); | 265 | | ||
266 | // Use the same step size as KDirOperator does | ||||
267 | const QFontMetrics metrics(font()); | ||||
268 | singleStep = metrics.height() * 2.5; | ||||
anthonyfieroni: I always think that we have that step in library, i have in mind that in system settings has a… | |||||
ngraham: See https://bugs.kde.org/show_bug.cgi?id=403842 | |||||
Note that in D25683 I have used QApplication::wheelScrollLines() which to me seems to be the right method to use for this. ahiemstra: Note that in D25683 I have used `QApplication::wheelScrollLines()` which to me seems to be the… | |||||
269 | | ||||
265 | // We cannot use view->size().height() because this height might | 270 | // We cannot use view->size().height() because this height might | ||
266 | // include the header widget, which is not part of the scrolled area. | 271 | // include the header widget, which is not part of the scrolled area. | ||
267 | pageStep = view->verticalPageStep(); | 272 | pageStep = view->verticalPageStep(); | ||
268 | 273 | | |||
269 | // However, the total height of the view must be considered for the | 274 | // However, the total height of the view must be considered for the | ||
270 | // maximum value of the scroll bar. Note that the view's scrollOffset() | 275 | // maximum value of the scroll bar. Note that the view's scrollOffset() | ||
271 | // refers to the offset of the top part of the view, which might be | 276 | // refers to the offset of the top part of the view, which might be | ||
272 | // hidden behind the header. | 277 | // hidden behind the header. | ||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |
I always think that we have that step in library, i have in mind that in system settings has a scroll speed, now i don't see, somethings changed and i did not notice :)