1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 23:03:22 +02:00
GPXSee/src/waypointitem.h

41 lines
902 B
C
Raw Normal View History

2016-02-19 21:34:55 +01:00
#ifndef WAYPOINTITEM_H
#define WAYPOINTITEM_H
2015-10-05 01:43:48 +02:00
#include <QGraphicsItem>
2016-02-12 10:09:17 +01:00
#include "waypoint.h"
2016-08-02 00:28:56 +02:00
#include "units.h"
2015-10-05 01:43:48 +02:00
2016-02-19 21:42:54 +01:00
class WaypointItem : public QGraphicsItem
2015-10-05 01:43:48 +02:00
{
public:
WaypointItem(const Waypoint &waypoint, QGraphicsItem *parent = 0);
2015-10-05 01:43:48 +02:00
const Waypoint &waypoint() const {return _waypoint;}
const QPointF &coordinates() const {return _coordinates;}
2015-10-05 01:43:48 +02:00
2016-08-02 00:28:56 +02:00
void setUnits(enum Units units);
void setScale(qreal scale);
2016-08-09 01:16:19 +02:00
void showLabel(bool show);
2016-08-02 00:28:56 +02:00
QRectF boundingRect() const {return _boundingRect;}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
2015-10-05 01:43:48 +02:00
private:
2016-09-10 13:11:46 +02:00
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
2015-10-05 01:43:48 +02:00
void updateBoundingRect();
2016-08-02 00:28:56 +02:00
QString toolTip();
2015-10-05 01:43:48 +02:00
QRectF _boundingRect;
QPointF _coordinates;
Waypoint _waypoint;
2016-08-02 00:28:56 +02:00
Units _units;
2016-09-10 13:11:46 +02:00
bool _hover;
2016-08-09 01:16:19 +02:00
bool _showLabel;
2015-10-05 01:43:48 +02:00
};
2016-02-19 21:34:55 +01:00
#endif // WAYPOINTITEM_H