summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-10-02 13:11:23 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-10-02 13:42:18 (GMT)
commit6bfc155e1e3e2dd7d3cf4cd1607103af9a6f592c (patch)
treebf360b8d6bdb16600da147dfc3dd3cc1b8cb6699 /src
parent9711987fb0ba2841016dd75c1f3a3d2276b8cc69 (diff)
downloadQt-6bfc155e1e3e2dd7d3cf4cd1607103af9a6f592c.zip
Qt-6bfc155e1e3e2dd7d3cf4cd1607103af9a6f592c.tar.gz
Qt-6bfc155e1e3e2dd7d3cf4cd1607103af9a6f592c.tar.bz2
Mac: bugfix 45f095b8970dc3c1b6f6e97fa2323654ba848288
Seems like I forgot to handle page scrolls. Also did a small optimization (see also 45f095b8970dc3c1b6f6e97fa2323654ba848288)
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qabstractslider.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index 28f3be3..19a8b63 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -694,7 +694,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
return;
qreal currentOffset = qreal(e->delta()) / 120;
- d->offset_accumulated += d->invertedControls ? -currentOffset : currentOffset;
+ d->offset_accumulated += currentOffset;
if (int(d->offset_accumulated) == 0) {
// QAbstractSlider works on integer values. So if the accumulated
// offset is less than +/- 1, we need to wait until we get more
@@ -703,17 +703,24 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
return;
}
- // Calculate the number of steps to scroll (per 15 degrees of rotate):
+ int stepsToScroll;
+ if ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::ShiftModifier)) {
+ stepsToScroll = currentOffset > 0 ? d->pageStep : -d->pageStep;
+ } else {
+ // Calculate the number of steps to scroll (per 15 degrees of rotate):
#ifdef Q_OS_MAC
- // On mac, since mouse wheel scrolling is accelerated and
- // fine tuned by the OS, we skip applying acceleration:
- int stepsToScroll = int(d->offset_accumulated);
+ // On mac, since mouse wheel scrolling is accelerated and
+ // fine tuned by the OS, we skip applying acceleration:
+ stepsToScroll = int(d->offset_accumulated);
#else
- int step = qMin(QApplication::wheelScrollLines() * d->singleStep, d->pageStep);
- if ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::ShiftModifier))
- step = d->pageStep;
- int stepsToScroll = step * int(d->offset_accumulated);
+ stepsToScroll = int(d->offset_accumulated) * QApplication::wheelScrollLines() * d->singleStep;
#endif
+ if (qAbs(stepsToScroll) > d->pageStep)
+ stepsToScroll = currentOffset > 0 ? d->pageStep : -d->pageStep;
+ }
+
+ if (d->invertedControls)
+ stepsToScroll = -stepsToScroll;
int prevValue = d->value;
d->position = d->overflowSafeAdd(stepsToScroll); // value will be updated by triggerAction()