Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/QtNodes/internal/NodeDelegateModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <QMetaType>
#include <QPixmap>
#include <QtGui/QColor>
#include <QtWidgets/QWidget>

#include "Definitions.hpp"
Expand Down Expand Up @@ -103,6 +104,9 @@ class NODE_EDITOR_PUBLIC NodeDelegateModel

void setNodeStyle(NodeStyle const &style);

/// Convenience helper to change the node background color.
void setBackgroundColor(QColor const &color);

QPixmap processingStatusIcon() const;

void setStatusIcon(NodeProcessingStatus status, const QPixmap &pixmap);
Expand Down
6 changes: 6 additions & 0 deletions include/QtNodes/internal/NodeStyle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ class NODE_EDITOR_PUBLIC NodeStyle : public Style

QJsonObject toJson() const override;

/// Set uniform background color for the node.
void setBackgroundColor(QColor const &color);

/// Current uniform background color.
QColor backgroundColor() const;

public:
QColor NormalBoundaryColor;
QColor SelectedBoundaryColor;
Expand Down
5 changes: 5 additions & 0 deletions src/NodeDelegateModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,9 @@ void NodeDelegateModel::setNodeProcessingStatus(NodeProcessingStatus status)
_processingStatus = status;
}

void NodeDelegateModel::setBackgroundColor(QColor const &color)
{
_nodeStyle.setBackgroundColor(color);
}

} // namespace QtNodes
13 changes: 13 additions & 0 deletions src/NodeStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,16 @@ QJsonObject NodeStyle::toJson() const

return root;
}

void NodeStyle::setBackgroundColor(QColor const &color)
{
GradientColor0 = color;
GradientColor1 = color;
GradientColor2 = color;
GradientColor3 = color;
}

QColor NodeStyle::backgroundColor() const
{
return GradientColor0;
}
Loading