From 1b7ce85a606261936efd3b3c7d73a71b5884e426 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Tue, 30 Jul 2019 16:42:12 +0200 Subject: Remove usages of deprecated APIs of QWheelEvent - Replaced the usages of deprecated QWheelEvent::delta() and QWheelEvent::orientation() with QWheelEvent::angleDelta(). In most of the examples it is acceptable to use only the vertical component of angle delta. - Made the docs APIs to build conditionally, based on the deprecation version. Task-number: QTBUG-76491 Task-number: QTBUG-76540 Change-Id: Id4230d483f724af49e4b6349b44881c3944de2a2 Reviewed-by: Volker Hilsheimer --- examples/corelib/threads/doc/src/mandelbrot.qdoc | 4 ++-- examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/corelib/threads') diff --git a/examples/corelib/threads/doc/src/mandelbrot.qdoc b/examples/corelib/threads/doc/src/mandelbrot.qdoc index 274874632e..9e3fdc1dfe 100644 --- a/examples/corelib/threads/doc/src/mandelbrot.qdoc +++ b/examples/corelib/threads/doc/src/mandelbrot.qdoc @@ -304,8 +304,8 @@ \snippet threads/mandelbrot/mandelbrotwidget.cpp 12 The wheel event handler is reimplemented to make the mouse wheel - control the zoom level. QWheelEvent::delta() returns the angle of - the wheel mouse movement, in eights of a degree. For most mice, + control the zoom level. QWheelEvent::angleDelta() returns the angle + of the wheel mouse movement, in eighths of a degree. For most mice, one wheel step corresponds to 15 degrees. We find out how many mouse steps we have and determine the resulting zoom factor. For example, if we have two wheel steps in the positive direction diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp index 71d0abb09f..822791533b 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp @@ -176,7 +176,7 @@ void MandelbrotWidget::keyPressEvent(QKeyEvent *event) //! [12] void MandelbrotWidget::wheelEvent(QWheelEvent *event) { - int numDegrees = event->delta() / 8; + int numDegrees = event->angleDelta().y() / 8; double numSteps = numDegrees / 15.0f; zoom(pow(ZoomInFactor, numSteps)); } -- cgit v1.2.3