-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.h
39 lines (33 loc) · 882 Bytes
/
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
#ifndef NODE_H
#define NODE_H
#include <QGraphicsItem>
#include <QObject>
class QString;
class QColor;
class Node : public QGraphicsItem
{
public:
Node();
~Node();
//Node外观控制
void setText(const QString &text);
QString text() const;
void setTextColor(const QColor &color);
QColor textColor() const;
void setOutlineColor(const QColor &color);
QColor outlineColor() const;
void setBackgroundColor(const QColor &color);
QColor backgroundColor() const;
//重新实现基类函数
QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
QRectF outlineRect() const;
int roundness(double size) const;
QString myText;
QColor myTextColor;
QColor myBackgroundColor;
QColor myOutlineColor;
};
#endif // NODE_H