1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Fixed scene (map) bounds not updating issue

Code cleanup
This commit is contained in:
Martin Tůma 2017-03-27 23:52:24 +02:00
parent 7fd30bbda3
commit 63c3a50ca6

View File

@ -72,7 +72,7 @@ PathView::PathView(Map *map, POI *poi, QWidget *parent)
_plot = false;
setSceneRect(_map->bounds());
_scene->setSceneRect(_map->bounds());
_res = _map->resolution(_scene->sceneRect().center());
}
@ -231,7 +231,8 @@ void PathView::updatePOIVisibility()
void PathView::rescale()
{
setSceneRect(_map->bounds());
_scene->setSceneRect(_map->bounds());
resetCachedContent();
for (int i = 0; i < _tracks.size(); i++)
_tracks.at(i)->setMap(_map);
@ -268,7 +269,7 @@ void PathView::setMap(Map *map)
connect(_map, SIGNAL(loaded()), this, SLOT(redraw()));
mapScale();
setSceneRect(_map->bounds());
_scene->setSceneRect(_map->bounds());
for (int i = 0; i < _tracks.size(); i++)
_tracks.at(i)->setMap(map);
@ -367,8 +368,6 @@ void PathView::zoom(const QPoint &pos, const Coordinates &c)
_res = _map->resolution(center);
_mapScale->setResolution(_res);
resetCachedContent();
}
void PathView::wheelEvent(QWheelEvent *event)
@ -469,9 +468,6 @@ void PathView::clear()
_tr = QRectF(); _rr = QRectF(); _wr = QRectF();
_wp = QPointF();
setSceneRect(_map->bounds());
_res = _map->resolution(_scene->sceneRect().center());
}
void PathView::showTracks(bool show)
@ -594,8 +590,6 @@ void PathView::drawBackground(QPainter *painter, const QRectF &rect)
void PathView::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event);
qreal scale = _map->zoom();
if (mapScale() != scale)
rescale();
@ -606,7 +600,7 @@ void PathView::resizeEvent(QResizeEvent *event)
_res = _map->resolution(center);
_mapScale->setResolution(_res);
resetCachedContent();
QGraphicsView::resizeEvent(event);
}
void PathView::paintEvent(QPaintEvent *event)