diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-03-11 09:23:22 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-03-11 09:28:14 (GMT) |
commit | 7304cf9e0742fe112d8bf654fa5cd479523ea07a (patch) | |
tree | d2a57c434d6a92fe31e8b92199f4ba1630504c64 /src/gui/widgets/qabstractslider.cpp | |
parent | b5d9d2eb1fbfbbf2732e90ef4d6a3e3ae5104c0c (diff) | |
download | Qt-7304cf9e0742fe112d8bf654fa5cd479523ea07a.zip Qt-7304cf9e0742fe112d8bf654fa5cd479523ea07a.tar.gz Qt-7304cf9e0742fe112d8bf654fa5cd479523ea07a.tar.bz2 |
Mac: scroll speed does not match native applications
It turns out that we limit wheel scrolling on mac to an
upper limit per event to one page. This behaviour is a bit
strange in the first place, and on mac, it is just wrong.
Besides, even when this limitation is removed, we still scroll
a bit slower that native. The 'problem' is to come up with a
good conversion from pixel scrolling to line based
scrolling (Qt does not really have an API for pixel scrolling).
But we up the speed a bit to make it perform more similar to
xcode.
Rev-by: msorvig
Diffstat (limited to 'src/gui/widgets/qabstractslider.cpp')
-rw-r--r-- | src/gui/widgets/qabstractslider.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 2888490..522d472 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -712,7 +712,15 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb offset_accumulated = 0; offset_accumulated += stepsToScrollF; +#ifndef Q_WS_MAC + // Dont't scroll more than one page in any case: stepsToScroll = qBound(-pageStep, int(offset_accumulated), pageStep); +#else + // Native UI-elements on Mac can scroll hundreds of lines at a time as + // a result of acceleration. So keep the same behaviour in Qt, and + // dont restrict stepsToScroll to certain maximum (pageStep): + stepsToScroll = int(offset_accumulated); +#endif offset_accumulated -= int(offset_accumulated); if (stepsToScroll == 0) return false; |