Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2edfb0b
Updates fork from upstream
tatatupi Jun 20, 2025
545c018
Updates fork from upstream
Gabrielnmds Aug 5, 2025
6af24c7
improves NodeValidationState struct
tatatupi Jun 23, 2025
4038ee0
qt6 for linux-gcc
tatatupi Jun 23, 2025
996dbaa
adds node nickname functionality
Gabrielnmds Jul 12, 2025
0ed2133
Adjust label layout
tatatupi Jul 22, 2025
44ad376
improve caption and nickname dynamic
g-abilio Jul 23, 2025
90c8fa6
add editable nickname label
tatatupi Jul 25, 2025
a009f67
add correct caption dynamic, as well as labelEdit max size
g-abilio Jul 25, 2025
3783323
fix alignment issues between nickname and node caption
g-abilio Aug 4, 2025
1ac664a
solves conflict
tatatupi Sep 11, 2025
88d9fd4
revert workflows change
tatatupi Sep 11, 2025
b1714b2
fix segfault detected in dataflowgraphmodel tests
g-abilio Sep 12, 2025
206cf09
produces optional nickname structure and adds example
g-abilio Sep 18, 2025
540046d
fix typo in spacing method and attribute
g-abilio Sep 18, 2025
921e243
uniformizes icon files attributes
tatatupi Nov 11, 2025
974d115
removes commented code
tatatupi Nov 11, 2025
f171a55
improves processing status icon resolution
tatatupi Nov 13, 2025
6a5530b
solves situations where icons should not appear
g-abilio Nov 13, 2025
46d9717
adds docstring to each nodeprocessingstatus
g-abilio Nov 13, 2025
13d6c53
adds possibility to change the node processing status icon style
tatatupi Nov 13, 2025
82e4a87
moves all status logic to NodeStyle
tatatupi Nov 13, 2025
43e1d51
removes unnecessary code
tatatupi Nov 13, 2025
156433c
adds declaration of QPixmap
tatatupi Nov 13, 2025
c0457af
solve conflicts
g-abilio Dec 10, 2025
e2051bd
pull new node_processing_status and solve conflicts
g-abilio Dec 10, 2025
fc93e4d
solve minor errors
g-abilio Dec 15, 2025
db79277
remove unnecessary changes
g-abilio Dec 15, 2025
d96c52e
solve conflicts
g-abilio Dec 15, 2025
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
2 changes: 2 additions & 0 deletions examples/styles/models.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class MyDataModel : public NodeDelegateModel

QString name() const override { return QString("MyDataModel"); }

bool labelEditable() const override { return true; }

public:
QJsonObject save() const override
{
Expand Down
17 changes: 13 additions & 4 deletions include/QtNodes/internal/AbstractNodeGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class NODE_EDITOR_PUBLIC AbstractNodeGeometry
/// Port position in node's coordinate system.
virtual QPointF portPosition(NodeId const nodeId,
PortType const portType,
PortIndex const index) const
= 0;
PortIndex const index) const = 0;

/// A convenience function using the `portPosition` and a given transformation.
virtual QPointF portScenePosition(NodeId const nodeId,
Expand All @@ -48,8 +47,7 @@ class NODE_EDITOR_PUBLIC AbstractNodeGeometry
/// Defines where to draw port label. The point corresponds to a font baseline.
virtual QPointF portTextPosition(NodeId const nodeId,
PortType const portType,
PortIndex const portIndex) const
= 0;
PortIndex const portIndex) const = 0;

/**
* Defines where to start drawing the caption. The point corresponds to a font
Expand All @@ -60,6 +58,15 @@ class NODE_EDITOR_PUBLIC AbstractNodeGeometry
/// Caption rect is needed for estimating the total node size.
virtual QRectF captionRect(NodeId const nodeId) const = 0;

/**
* Defines where to start drawing the label. The point corresponds to a font
* baseline.
*/
virtual QPointF labelPosition(NodeId const nodeId) const = 0;

/// Caption rect is needed for estimating the total node size.
virtual QRectF labelRect(NodeId const nodeId) const = 0;

/// Position for an embedded widget. Return any value if you don't embed.
virtual QPointF widgetPosition(NodeId const nodeId) const = 0;

Expand All @@ -69,6 +76,8 @@ class NODE_EDITOR_PUBLIC AbstractNodeGeometry

virtual QRect resizeHandleRect(NodeId const nodeId) const = 0;

virtual int getPortSpacing() = 0;

protected:
AbstractGraphModel &_graphModel;
};
Expand Down
5 changes: 5 additions & 0 deletions include/QtNodes/internal/DataFlowGraphModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <QJsonObject>

#include <memory>
#include <unordered_map>
#include <QString>

namespace QtNodes {

Expand Down Expand Up @@ -137,6 +139,9 @@ private Q_SLOTS:
std::unordered_set<ConnectionId> _connectivity;

mutable std::unordered_map<NodeId, NodeGeometryData> _nodeGeometryData;

std::unordered_map<NodeId, QString> _labels;
std::unordered_map<NodeId, bool> _labelsVisible;
};

} // namespace QtNodes
9 changes: 8 additions & 1 deletion include/QtNodes/internal/DefaultHorizontalNodeGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ class NODE_EDITOR_PUBLIC DefaultHorizontalNodeGeometry : public AbstractNodeGeom
QPointF portTextPosition(NodeId const nodeId,
PortType const portType,
PortIndex const PortIndex) const override;

QPointF captionPosition(NodeId const nodeId) const override;

QRectF captionRect(NodeId const nodeId) const override;

QPointF labelPosition(const NodeId nodeId) const override;

QRectF labelRect(NodeId const nodeId) const override;

QPointF widgetPosition(NodeId const nodeId) const override;

QRect resizeHandleRect(NodeId const nodeId) const override;

int getPortSpacing() override { return _portSpacing; }

private:
QRectF portTextRect(NodeId const nodeId,
PortType const portType,
Expand All @@ -52,7 +59,7 @@ class NODE_EDITOR_PUBLIC DefaultHorizontalNodeGeometry : public AbstractNodeGeom
// constness of the Node.

mutable unsigned int _portSize;
unsigned int _portSpasing;
unsigned int _portSpacing;
mutable QFontMetrics _fontMetrics;
mutable QFontMetrics _boldFontMetrics;
};
Expand Down
7 changes: 4 additions & 3 deletions include/QtNodes/internal/DefaultNodePainter.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#pragma once

#include <QIcon>
#include <QtGui/QPainter>

#include "AbstractNodePainter.hpp"
#include "Definitions.hpp"
#include <QIcon>
#include <QtGui/QPainter>

namespace QtNodes {

Expand All @@ -28,6 +27,8 @@ class NODE_EDITOR_PUBLIC DefaultNodePainter : public AbstractNodePainter

void drawNodeCaption(QPainter *painter, NodeGraphicsObject &ngo) const;

void drawNodeLabel(QPainter *painter, NodeGraphicsObject &ngo) const;

void drawEntryLabels(QPainter *painter, NodeGraphicsObject &ngo) const;

void drawResizeRect(QPainter *painter, NodeGraphicsObject &ngo) const;
Expand Down
8 changes: 7 additions & 1 deletion include/QtNodes/internal/DefaultVerticalNodeGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ class NODE_EDITOR_PUBLIC DefaultVerticalNodeGeometry : public AbstractNodeGeomet

QRectF captionRect(NodeId const nodeId) const override;

QPointF labelPosition(const NodeId nodeId) const override;

QRectF labelRect(NodeId const nodeId) const override;

QPointF widgetPosition(NodeId const nodeId) const override;

QRect resizeHandleRect(NodeId const nodeId) const override;

int getPortSpacing() override { return _portSpacing; }

private:
QRectF portTextRect(NodeId const nodeId,
PortType const portType,
Expand All @@ -54,7 +60,7 @@ class NODE_EDITOR_PUBLIC DefaultVerticalNodeGeometry : public AbstractNodeGeomet
// constness of the Node.

mutable unsigned int _portSize;
unsigned int _portSpasing;
unsigned int _portSpacing;
mutable QFontMetrics _fontMetrics;
mutable QFontMetrics _boldFontMetrics;
};
Expand Down
37 changes: 20 additions & 17 deletions include/QtNodes/internal/Definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,26 @@ NODE_EDITOR_PUBLIC Q_NAMESPACE
Q_NAMESPACE_EXPORT(NODE_EDITOR_PUBLIC)
#endif

/**
* Constants used for fetching QVariant data from GraphModel.
*/
enum class NodeRole {
Type = 0, ///< Type of the current node, usually a string.
Position = 1, ///< `QPointF` positon of the node on the scene.
Size = 2, ///< `QSize` for resizable nodes.
CaptionVisible = 3, ///< `bool` for caption visibility.
Caption = 4, ///< `QString` for node caption.
Style = 5, ///< Custom NodeStyle as QJsonDocument
InternalData = 6, ///< Node-stecific user data as QJsonObject
InPortCount = 7, ///< `unsigned int`
OutPortCount = 9, ///< `unsigned int`
Widget = 10, ///< Optional `QWidget*` or `nullptr`
ValidationState = 11, ///< Enum NodeValidationState of the node
ProcessingStatus = 12 ///< Enum NodeProcessingStatus of the node
};
/**
* Constants used for fetching QVariant data from GraphModel.
*/
enum class NodeRole {
Type = 0, ///< Type of the current node, usually a string.
Position = 1, ///< `QPointF` positon of the node on the scene.
Size = 2, ///< `QSize` for resizable nodes.
CaptionVisible = 3, ///< `bool` for caption visibility.
Caption = 4, ///< `QString` for node caption.
Style = 5, ///< Custom NodeStyle as QJsonDocument
InternalData = 6, ///< Node-stecific user data as QJsonObject
InPortCount = 7, ///< `unsigned int`
OutPortCount = 9, ///< `unsigned int`
Widget = 10, ///< Optional `QWidget*` or `nullptr`
ValidationState = 11, ///< Enum NodeValidationState of the node
LabelVisible = 12, ///< `bool` for label visibility.
ProcessingStatus = 13, ///< Enum NodeProcessingStatus of the node
Label = 14, ///< `QString` for node label.
LabelEditable = 15, ///< `bool` to indicate label editing support.
};
Q_ENUM_NS(NodeRole)

/**
Expand Down
6 changes: 6 additions & 0 deletions include/QtNodes/internal/GraphicsView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

#include <QtWidgets/QGraphicsView>

#include "Definitions.hpp"
#include "Export.hpp"

class QLineEdit;

namespace QtNodes {

class BasicGraphicsScene;
Expand Down Expand Up @@ -93,5 +96,8 @@ public Q_SLOTS:

QPointF _clickPos;
ScaleRange _scaleRange;

QLineEdit *_labelEdit = nullptr;
NodeId _editingNodeId = InvalidNodeId;
};
} // namespace QtNodes
21 changes: 14 additions & 7 deletions include/QtNodes/internal/NodeDelegateModel.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#pragma once

#include <memory>

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

#include "Definitions.hpp"
#include "Export.hpp"
#include "NodeData.hpp"
#include "NodeStyle.hpp"
#include "Serializable.hpp"
#include <memory>
#include <QMetaType>
#include <QPixmap>
#include <QtGui/QColor>
#include <QtWidgets/QWidget>

namespace QtNodes {

Expand Down Expand Up @@ -80,6 +78,15 @@ class NODE_EDITOR_PUBLIC NodeDelegateModel
/// It is possible to hide port caption in GUI
virtual bool portCaptionVisible(PortType, PortIndex) const { return false; }

/// Nicknames can be assigned to nodes and shown in GUI
virtual QString label() const { return QString(); }

/// It is possible to hide the nickname in GUI
virtual bool labelVisible() const { return true; }

/// Controls whether the label can be edited or not
virtual bool labelEditable() const { return false; }

/// Validation State will default to Valid, but you can manipulate it by overriding in an inherited class
virtual NodeValidationState validationState() const { return _nodeValidationState; }

Expand Down
2 changes: 1 addition & 1 deletion include/QtNodes/internal/UndoCommands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include "Definitions.hpp"
#include "Export.hpp"

#include <QUndoCommand>
#include <QtCore/QJsonObject>
#include <QtCore/QPointF>
#include <QUndoCommand>

#include <unordered_set>

Expand Down
2 changes: 1 addition & 1 deletion resources/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<file>status_icons/partial.svg</file>
<file>status_icons/pending.svg</file>
<file>status_icons/processing.svg</file>
<file>status_icons/updated.svg</file>
<file>status_icons/updated.svg</file>
</qresource>
</RCC>
2 changes: 1 addition & 1 deletion resources/status_icons/empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/status_icons/failed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/status_icons/partial.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/status_icons/pending.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/status_icons/processing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/status_icons/updated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading