-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqgraphicsedgeitem.h
More file actions
43 lines (37 loc) · 1.05 KB
/
Copy pathqgraphicsedgeitem.h
File metadata and controls
43 lines (37 loc) · 1.05 KB
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
/*
MIT License
Copyright (c) 2021 Ramesh Choudhary
*/
#ifndef QGRAPHICSEDGEITEM_H
#define QGRAPHICSEDGEITEM_H
#include<QGraphicsSceneMouseEvent>
#include<QGraphicsObject>
#include<QtMath>
#include<QPainter>
class QGraphicsNodeItem;
class QGraphicsEdgeItem:public QGraphicsObject
{
public:
QGraphicsEdgeItem(QGraphicsNodeItem * node1, QGraphicsNodeItem * node2,
QGraphicsScene * scene,QGraphicsItem * parent=nullptr);
void setArrow(bool set);
QLineF edge();
void setEdge(QLineF edge);
void setPen(QPen pen);
QPen & pen();
void setEdgeSize(uint size);
void detachAndDelete();
QPair<QGraphicsNodeItem * ,QGraphicsNodeItem *> getArrowDirection();
// QGraphicsItem interface
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * widget) override;
QRectF boundingRect() const override;
private:
QLineF m_edge;
QPen m_pen;
bool m_hasArrow=true;
QGraphicsNodeItem * node1;
QGraphicsNodeItem * node2;
int m_zValue=1;
QGraphicsScene * m_scene;
};
#endif // QGRAPHICSEDGEITEM_H