[viewer] fix qt6
This commit is contained in:
parent
d96b6843b3
commit
8714432a67
2 changed files with 19 additions and 2 deletions
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue