-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoint.h
44 lines (33 loc) · 1.05 KB
/
endpoint.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef ENDPOINT_H
#define ENDPOINT_H
#include <QGraphicsObject>
#include "edgeitem.h"
class EndPoint : public QGraphicsObject
{
Q_OBJECT
public:
EndPoint(EdgeItem* edgeItem, LabelImage* labelImage, unsigned int pointIndex);
EndPoint(LabelImage* labelImage, QPointF position);
unsigned int indexOnEdge() const;
void moveTo(unsigned int newIndex);
void blink();
QRectF boundingRect() const override;
QPainterPath shape() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
double radius;
QColor color;
QColor createModeColor;
double borderWidth;
double padding;
EdgeItem* parent;
LabelImage* image;
unsigned int index;
unsigned int oldIndex;
QPointF oldPos;
};
#endif // ENDPOINT_H