-
Notifications
You must be signed in to change notification settings - Fork 1
/
node.h
51 lines (36 loc) · 1.04 KB
/
node.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
45
46
47
48
49
50
51
#ifndef NODE_H
#define NODE_H
#include <QGraphicsItem>
class Link;
class Node : public QGraphicsItem
{
public:
Node(QGraphicsScene *scene);
~Node();
void setText(const QStringList &text);
void addParent(Node *parent);
void addChild(Node *child);
void addLink(Link *link);
void removeLink(Link *link);
QList<Link *> getLinkList();
QRectF outlineRect() const;
QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QStringList getText() const;
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
private:
QPointF nextChildP();
QPointF nextParentP();
private:
QGraphicsScene *m_scene;
QStringList m_texts;
qreal m_width;
QList<Link *> m_linkList;
QList<Node *> m_parents;
QList<Node *> m_childs;
};
#endif // NODE_H