summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-07-30 16:42:12 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-08-23 21:51:43 +0200
commit1b7ce85a606261936efd3b3c7d73a71b5884e426 (patch)
treef76713753768436ba14a98f01874456dc65bf8b0 /examples/widgets/widgets
parent5d94aac2bae8bdbf8de7cebeb6a1a17a81685f0a (diff)
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 <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples/widgets/widgets')
-rw-r--r--examples/widgets/widgets/mousebuttons/buttontester.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/widgets/widgets/mousebuttons/buttontester.cpp b/examples/widgets/widgets/mousebuttons/buttontester.cpp
index 6653221698..88dbbeda45 100644
--- a/examples/widgets/widgets/mousebuttons/buttontester.cpp
+++ b/examples/widgets/widgets/mousebuttons/buttontester.cpp
@@ -93,15 +93,16 @@ void ButtonTester::mouseDoubleClickEvent(QMouseEvent *e)
void ButtonTester::wheelEvent (QWheelEvent *e)
{
QString result;
- if (e->delta() > 0) {
-
- if (e->orientation() == Qt::Vertical) {
+ const bool vertical = qAbs(e->angleDelta().y()) >= qAbs(e->angleDelta().x());
+ const int delta = vertical ? e->angleDelta().y() : e->angleDelta().x();
+ if (delta > 0) {
+ if (vertical) {
result = "Mouse Wheel Event: UP";
} else {
result = "Mouse Wheel Event: LEFT";
}
- } else if (e->delta() < 0) {
- if (e->orientation() == Qt::Vertical) {
+ } else if (delta < 0) {
+ if (vertical) {
result = "Mouse Wheel Event: DOWN";
} else {
result = "Mouse Wheel Event: RIGHT";