DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
DANodePalette.h
1#ifndef DANODEPALETTE_H
2#define DANODEPALETTE_H
3#include <QtCore/qglobal.h>
4#include <QColor>
5#include <QBrush>
6#include "DAWorkFlowAPI.h"
7
8#ifndef DANODEPALETTE_PROPERTY_COLOR
9#define DANODEPALETTE_PROPERTY_COLOR(RoleName, Role) \
10 const QColor& get##RoleName() const \
11 { \
12 return getColor(Role); \
13 } \
14 static const QColor& getGlobal##RoleName() \
15 { \
16 return getGlobalPalette().get##RoleName(); \
17 }
18#endif
19#ifndef DANODEPALETTE_PROPERTY_BRUSH
20#define DANODEPALETTE_PROPERTY_BRUSH(RoleName, Role) \
21 const QBrush& get##RoleName() const \
22 { \
23 return getBrush(Role); \
24 } \
25 static const QBrush& getGlobal##RoleName() \
26 { \
27 return getGlobalPalette().get##RoleName(); \
28 }
29#endif
30namespace DA
31{
39class DAWORKFLOW_API DANodePalette
40{
41public:
46 {
47 RoleTextColor = 0,
48 RoleBorderColor = 1,
49 RoleLinkLineColor = 2,
50 RoleLinkPointBorderColor = 3
51 };
56 {
57 RoleBackgroundBrush = 0,
59 RoleOutLinkPointBrush
60 };
62 static DANodePalette& getGlobalPalette();
63 // 颜色相关操作
64 QColor& color(ColorRole r);
65 const QColor& getColor(ColorRole r) const;
66 static const QColor& getGlobalColor(ColorRole r);
67 // 画刷相关操作
68 QBrush& brush(BrushRole r);
69 const QBrush& getBrush(BrushRole r) const;
70 static const QBrush& getGlobalBrush(BrushRole r);
71 DANODEPALETTE_PROPERTY_COLOR(TextColor, RoleTextColor)
72 DANODEPALETTE_PROPERTY_COLOR(BorderColor, RoleBorderColor)
73 DANODEPALETTE_PROPERTY_COLOR(LinkLineColor, RoleLinkLineColor)
74 DANODEPALETTE_PROPERTY_COLOR(LinkPointBorderColor, RoleLinkPointBorderColor)
75
76 // brush
77 DANODEPALETTE_PROPERTY_BRUSH(BackgroundBrush, RoleBackgroundBrush)
78 DANODEPALETTE_PROPERTY_BRUSH(InLinkPointBrush, RoleInLinkPointBrush)
79 DANODEPALETTE_PROPERTY_BRUSH(OutLinkPointBrush, RoleOutLinkPointBrush)
80
81private:
82 QList< QColor > mColors;
83 QList< QBrush > mBrushs;
84};
85} // end of namespace DA
86
87#endif // FCNODEPALETTE_H
节点相关的调色板,这里封装了节点相关的大部分颜色,
Definition DANodePalette.h:40
BrushRole
颜色角色
Definition DANodePalette.h:56
@ RoleInLinkPointBrush
入口连接点的背景
Definition DANodePalette.h:58
ColorRole
颜色角色
Definition DANodePalette.h:46
序列化类都是带异常的,使用中需要处理异常
Definition AppMainWindow.cpp:44