diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-07-03 13:28:58 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-07-12 15:13:01 +0200 |
commit | 7d29807296cb7ccc7f3459e106d74f93a321c493 (patch) | |
tree | 04844d21a3d09b4bfe5749033537831efdd077cc /src/widgets/widgets/qscrollbar.cpp | |
parent | 0a724ac74c5aa22a65ff0b81b762433b5d1e2002 (diff) |
Finish deprecating obsolete members of QWheelEvent
In Qt 5.0, delta() and orientation() were already marked obsolete,
but Widgets and tests have kept on depending on them all this time.
We now start using alternative API so they can really be deprecated.
All constructors except the newest one are also deprecated.
The plan is for all events from pointing devices to have
QPointF position() and globalPosition(), so we deprecate
the other position accessors.
[ChangeLog][QtGui] Obsolete constructors and accessors in QWheelEvent
now have proper deprecation macros. What is left is intended to be
compatible with planned changes in Qt 6.
Change-Id: I26250dc90922b60a6ed20d7f65f38019da3e139e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qscrollbar.cpp')
-rw-r--r-- | src/widgets/widgets/qscrollbar.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index b4168268a0..08d771a27a 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -497,16 +497,14 @@ bool QScrollBar::event(QEvent *event) void QScrollBar::wheelEvent(QWheelEvent *event) { event->ignore(); - int delta = event->delta(); // scrollbar is a special case - in vertical mode it reaches minimum // value in the upper position, however QSlider's minimum value is on - // the bottom. So we need to invert a value, but since the scrollbar is - // inverted by default, we need to inverse the delta value for the + // the bottom. So we need to invert the value, but since the scrollbar is + // inverted by default, we need to invert the delta value only for the // horizontal orientation. - if (event->orientation() == Qt::Horizontal) - delta = -delta; + int delta = (orientation() == Qt::Horizontal ? -event->angleDelta().x() : event->angleDelta().y()); Q_D(QScrollBar); - if (d->scrollByDelta(event->orientation(), event->modifiers(), delta)) + if (d->scrollByDelta(orientation(), event->modifiers(), delta)) event->accept(); if (event->phase() == Qt::ScrollBegin) |