1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Fixed broken coordinates info display under digital zoom

This commit is contained in:
Martin Tůma 2019-04-02 22:40:46 +02:00
parent c364121288
commit d70c4fefd5
3 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,8 @@ CoordinatesItem::CoordinatesItem(QGraphicsItem *parent) : QGraphicsItem(parent)
_font.setPixelSize(FONT_SIZE);
_font.setFamily(FONT_FAMILY);
_digitalZoom = 0;
updateBoundingRect();
}
@ -48,6 +50,12 @@ void CoordinatesItem::setFormat(const CoordinatesFormat &format)
updateBoundingRect();
}
void CoordinatesItem::setDigitalZoom(qreal zoom)
{
_digitalZoom = zoom;
setScale(pow(2, -_digitalZoom));
}
void CoordinatesItem::updateBoundingRect()
{
QFontMetrics fm(_font);

View File

@ -17,6 +17,7 @@ public:
void setCoordinates(const Coordinates &c);
void setFormat(const CoordinatesFormat &format);
void setDigitalZoom(qreal zoom);
private:
void updateBoundingRect();
@ -25,6 +26,7 @@ private:
CoordinatesFormat _format;
QRectF _boundingRect;
QFont _font;
qreal _digitalZoom;
};
#endif // COORDINATESITEM_H

View File

@ -476,6 +476,7 @@ void MapView::digitalZoom(int zoom)
it.value()->setDigitalZoom(_digitalZoom);
_mapScale->setDigitalZoom(_digitalZoom);
_coordinates->setDigitalZoom(_digitalZoom);
}
void MapView::zoom(int zoom, const QPoint &pos)