File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed
Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 44
55#include < QMetaType>
66#include < QPixmap>
7+ #include < QtGui/QColor>
78#include < QtWidgets/QWidget>
89
910#include " Definitions.hpp"
@@ -103,6 +104,9 @@ class NODE_EDITOR_PUBLIC NodeDelegateModel
103104
104105 void setNodeStyle (NodeStyle const &style);
105106
107+ // / Convenience helper to change the node background color.
108+ void setBackgroundColor (QColor const &color);
109+
106110 QPixmap processingStatusIcon () const ;
107111
108112 void setStatusIcon (NodeProcessingStatus status, const QPixmap &pixmap);
Original file line number Diff line number Diff line change @@ -46,6 +46,12 @@ class NODE_EDITOR_PUBLIC NodeStyle : public Style
4646
4747 QJsonObject toJson () const override ;
4848
49+ // / Set uniform background color for the node.
50+ void setBackgroundColor (QColor const &color);
51+
52+ // / Current uniform background color.
53+ QColor backgroundColor () const ;
54+
4955public:
5056 QColor NormalBoundaryColor;
5157 QColor SelectedBoundaryColor;
Original file line number Diff line number Diff line change @@ -115,4 +115,9 @@ void NodeDelegateModel::setNodeProcessingStatus(NodeProcessingStatus status)
115115 _processingStatus = status;
116116}
117117
118+ void NodeDelegateModel::setBackgroundColor (QColor const &color)
119+ {
120+ _nodeStyle.setBackgroundColor (color);
121+ }
122+
118123} // namespace QtNodes
Original file line number Diff line number Diff line change @@ -156,3 +156,16 @@ QJsonObject NodeStyle::toJson() const
156156
157157 return root;
158158}
159+
160+ void NodeStyle::setBackgroundColor (QColor const &color)
161+ {
162+ GradientColor0 = color;
163+ GradientColor1 = color;
164+ GradientColor2 = color;
165+ GradientColor3 = color;
166+ }
167+
168+ QColor NodeStyle::backgroundColor () const
169+ {
170+ return GradientColor0;
171+ }
You can’t perform that action at this time.
0 commit comments