1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 23:03:22 +02:00
GPXSee/src/pathitem.h
Martin Tůma 1c0a0fd0b3 Fixed broken print/PDF export
(wrong map scale/waypoints size)
2017-05-01 12:59:56 +02:00

62 lines
1.1 KiB
C++

#ifndef PATHITEM_H
#define PATHITEM_H
#include <QGraphicsObject>
#include <QPen>
#include "markeritem.h"
#include "path.h"
class Map;
class PathItem : public QGraphicsObject
{
Q_OBJECT
public:
PathItem(const Path &path, Map *map, QGraphicsItem *parent = 0);
QPainterPath shape() const {return _shape;}
QRectF boundingRect() const {return _shape.boundingRect();}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
const Path &path() const {return _path;}
void setMap(Map *map);
void setColor(const QColor &color);
void setWidth(qreal width);
void setStyle(Qt::PenStyle style);
void setDigitalZoom(int zoom);
public slots:
void moveMarker(qreal distance);
signals:
void selected(bool);
protected:
Path _path;
MarkerItem *_marker;
private:
QPointF position(qreal distance) const;
void updatePainterPath(Map *map);
void updateShape();
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
Map *_map;
qreal _markerDistance;
int _digitalZoom;
qreal _width;
QPen _pen;
QPainterPath _shape;
QPainterPath _painterPath;
};
#endif // PATHITEM_H