summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-01-09 11:25:40 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-24 14:55:06 +0100
commit5a2efb490bc3549ef42420a0dafcf22072785e0d (patch)
tree5e0dc4396301e791fda198e9a11448532bc1aeec /src/widgets/kernel
parente8952aba2914722b0ad0e6f07e2193ead7f2e39d (diff)
QWheelEvent high-resolution delta support.
Support pixel-based deltas as well as sending dx and dy values in the same event. Keep source and behavior compatibility with Qt 4. New API: QPoint pixelDelta() const QPoint angleDelta() const Deprecate delta() and orientation(). Both pixel-based deltas and combined updates are necessary for smooth trackpad-based scrolling on OS X. Qt 4 compatible behavior is achieved by sending an extra wheel event in cases where the initial event has a combined dx and dy update. This extra event sends dx in delta() and orientation(), with pixelDelta() and angleDelta() set to null. Modify the Cocoa implementation to provide pixel deltas. It is expected that not all platforms can provide these. Angle deltas will always be available. Change-Id: I20c10f0df338ddcd6a3f7a4d40949ed5ae3b4795 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp4
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 650d4af38b..c350223278 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3357,8 +3357,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
while (w) {
- QWheelEvent we(relpos, wheel->globalPos(), wheel->delta(), wheel->buttons(),
- wheel->modifiers(), wheel->orientation());
+ QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
+ wheel->modifiers());
we.spont = wheel->spontaneous();
res = d->notify_helper(w, w == receiver ? wheel : &we);
eventAccepted = ((w == receiver) ? wheel : &we)->isAccepted();
diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp
index c04d8a9dc3..4d5e9d5774 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa.cpp
+++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp
@@ -364,7 +364,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event)
QPoint mapped = widget->mapFrom(m_widget, event->pos());
- QWheelEvent translated(mapped, event->globalPos(), event->delta(), event->buttons(), event->modifiers(), event->orientation());
+ QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->pixelDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers());
QGuiApplication::sendSpontaneousEvent(widget, &translated);
}