From eda02d2c1f898e4c02ccd2317973c2b8463a7037 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 16 Jul 2020 18:12:47 +0200 Subject: Make it work with Qt5. --- src/mapwidget.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mapwidget.cc') diff --git a/src/mapwidget.cc b/src/mapwidget.cc index b5f52d1..ba00799 100644 --- a/src/mapwidget.cc +++ b/src/mapwidget.cc @@ -47,11 +47,13 @@ float MapWidget::zoom() const void MapWidget::wheelEvent(QWheelEvent *event) { - if (event->orientation() == Qt::Vertical) { + QPoint p = event->angleDelta() / 120; - mapwidget_zoomfactor += event->delta() / 120; + if (!p.isNull()) { + + mapwidget_zoomfactor += p.y(); - if (mapwidget_zoomfactor < - 64) { + if (mapwidget_zoomfactor < -64) { mapwidget_zoomfactor = -64; } else if (mapwidget_zoomfactor > 64) { mapwidget_zoomfactor = 64; -- cgit v1.2.3