1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-27 17:04:24 +02:00

Removed the annoying map view re-zooming on window resize.

Fixes #74
This commit is contained in:
2019-06-10 19:12:34 +02:00
parent 3de0ed055a
commit 82b7fced53
3 changed files with 14 additions and 12 deletions

View File

@ -39,6 +39,7 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setRenderHint(QPainter::Antialiasing, true);
setResizeAnchor(QGraphicsView::AnchorViewCenter);
setAcceptDrops(false);
_mapScale = new ScaleItem();
@ -901,17 +902,6 @@ void MapView::drawBackground(QPainter *painter, const QRectF &rect)
}
}
void MapView::resizeEvent(QResizeEvent *event)
{
QGraphicsView::resizeEvent(event);
int zoom = _map->zoom();
if (fitMapZoom() != zoom)
rescale();
centerOn(contentCenter());
}
void MapView::paintEvent(QPaintEvent *event)
{
QPointF scaleScenePos = mapToScene(rect().bottomRight() + QPoint(
@ -1042,3 +1032,12 @@ void MapView::setProjection(int id)
rescale();
centerOn(_map->ll2xy(center));
}
void MapView::fitContentToSize()
{
int zoom = _map->zoom();
if (fitMapZoom() != zoom)
rescale();
centerOn(contentCenter());
}