1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00
GPXSee/src/GUI/scaleitem.h

43 lines
744 B
C
Raw Normal View History

2016-01-14 00:37:51 +01:00
#ifndef SCALEITEM_H
#define SCALEITEM_H
#include <QGraphicsItem>
#include "units.h"
class ScaleItem : public QGraphicsItem
{
public:
ScaleItem(QGraphicsItem *parent = 0);
QRectF boundingRect() const {return _boundingRect;}
2016-01-14 00:37:51 +01:00
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
2017-01-16 09:54:12 +01:00
void setResolution(qreal res);
2018-05-18 20:08:52 +02:00
void setUnits(Units units);
2017-08-31 16:28:37 +02:00
void setDigitalZoom(qreal zoom);
2016-01-14 00:37:51 +01:00
private:
2018-05-18 20:08:52 +02:00
struct Tick {
double value;
QRect boundingBox;
};
2016-01-14 00:37:51 +01:00
void computeScale();
2018-05-18 20:08:52 +02:00
void updateCache();
2016-01-14 00:37:51 +01:00
2017-01-16 09:54:12 +01:00
qreal _res;
2016-01-14 00:37:51 +01:00
qreal _width;
qreal _length;
Units _units;
bool _scale;
2017-08-31 16:28:37 +02:00
qreal _digitalZoom;
QRectF _boundingRect;
2018-05-18 01:38:33 +02:00
QFont _font;
2018-05-18 20:08:52 +02:00
QVector<Tick> _ticks;
QRect _unitsBB;
QString _unitsStr;
2016-01-14 00:37:51 +01:00
};
#endif // SCALEITEM_H