mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
parent
3de0ed055a
commit
82b7fced53
@ -2216,6 +2216,8 @@ void GUI::show()
|
||||
connect(w, SIGNAL(screenChanged(QScreen*)), this,
|
||||
SLOT(screenChanged(QScreen*)));
|
||||
#endif // ENABLE_HIDPI
|
||||
|
||||
_mapView->fitContentToSize();
|
||||
}
|
||||
|
||||
void GUI::screenChanged(QScreen *screen)
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -85,6 +85,8 @@ public slots:
|
||||
void setDevicePixelRatio(qreal deviceRatio, qreal mapRatio);
|
||||
void setProjection(int id);
|
||||
|
||||
void fitContentToSize();
|
||||
|
||||
private slots:
|
||||
void updatePOI();
|
||||
void reloadMap();
|
||||
@ -111,7 +113,6 @@ private:
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
|
Loading…
Reference in New Issue
Block a user