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);
|
|
|
|
|
2016-02-02 20:12:56 +01:00
|
|
|
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);
|
2016-01-14 00:37:51 +01:00
|
|
|
void setUnits(enum Units units);
|
2017-08-31 16:28:37 +02:00
|
|
|
void setDigitalZoom(qreal zoom);
|
2016-01-14 00:37:51 +01:00
|
|
|
|
|
|
|
private:
|
2016-02-02 20:12:56 +01:00
|
|
|
void updateBoundingRect();
|
2016-01-14 00:37:51 +01:00
|
|
|
void computeScale();
|
|
|
|
QString units() const;
|
|
|
|
|
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;
|
2016-02-02 20:12:56 +01:00
|
|
|
|
2017-08-31 16:28:37 +02:00
|
|
|
qreal _digitalZoom;
|
2017-05-01 12:59:56 +02:00
|
|
|
|
2016-02-02 20:12:56 +01:00
|
|
|
QRectF _boundingRect;
|
2016-01-14 00:37:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SCALEITEM_H
|