-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphicsNode.h
51 lines (42 loc) · 1.05 KB
/
GraphicsNode.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 GRAPHICSNODE_H
#define GRAPHICSNODE_H
#include <QGraphicsTextItem>
#include <QGraphicsItem>
#include <QString>
#include <QVector>
#include <QPen>
#include <QFont>
class Node;
class GraphicsNode : public QGraphicsItem
{
public:
GraphicsNode();
enum { Type = UserType + 1 };
int type() const override {
return Type;
}
void setTitle(QString titleText);
void setColor(QColor);
QRectF boundingRect() const override;
void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void setModel(Node *m) {
model = m;
};
Node *getModel() {
return model;
};
void setSize(QSize size);
private:
QString titleText;
QGraphicsTextItem *textItem;
QPen selectedOutlinePen;
QBrush headerBrush, titleBrush, bodyBrush;
QPen defaultOutlinePen;
QFont titleFont;
QColor titleColor;
QColor headerColor;
qreal width, height, titleHeight, radius;
Node *model;
};
#endif // GRAPHICSNODE_H