diff --git a/demo/viewer/layerdelegate.cpp b/demo/viewer/layerdelegate.cpp index b41ad1864..d441e1e11 100644 --- a/demo/viewer/layerdelegate.cpp +++ b/demo/viewer/layerdelegate.cpp @@ -38,7 +38,7 @@ void LayerDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, painter->setBrush(QBrush(QColor(255, 0, 0, 64))); - painter->drawRoundRect(option.rect,4,4); + painter->drawRoundedRect(option.rect,4,4); if (option.state & QStyle::State_Selected) painter->setBrush(option.palette.highlightedText()); diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index b1ea939b0..81579e373 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -293,7 +293,23 @@ void MapWidget::wheelEvent(QWheelEvent* e) { return; } - +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QPointF corner(map_->width(), map_->height()); + QPointF zoomCoords; + double zoom; + if (e->angleDelta().y() > 0) + { + zoom = 0.5; + QPointF center = corner / 2; + QPointF delta = e->position() - center; + zoomCoords = zoom * delta + center; + } + else + { + zoom = 2.0; + zoomCoords = corner - e->position(); + } +#else QPoint corner(map_->width(), map_->height()); QPoint zoomCoords; double zoom; @@ -309,6 +325,7 @@ void MapWidget::wheelEvent(QWheelEvent* e) zoom = 2.0; zoomCoords = corner - e->pos(); } +#endif map_->pan_and_zoom(zoomCoords.x(), zoomCoords.y(), zoom); updateMap();