Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
27433e0
Added duplicate action to the flow view. Removed shadow effect from n…
Nov 8, 2017
4b90d7d
Added duplicating connections, there is a bug to handle connections t…
Nov 8, 2017
c508028
added CTRL+D key sequence for duplicate
Nov 9, 2017
facd31b
Fixed node delete pointer error
Nov 9, 2017
a92ba58
Added very simple Undo Redo system
Nov 9, 2017
e42fe23
Added action context WidgetWithChildrenShortcut. Added duplication of…
Nov 14, 2017
b5f7310
added updating history for node movement
Nov 15, 2017
09a2681
Merge branch 'master' of https://github.com/paceholder/nodeeditor
Nov 15, 2017
d649c82
Added Fix for Mingw "invalid initialization of non-const reference of…
Nov 17, 2017
c073764
added setViewportUpdateMode(QGraphicsView::FullViewportUpdate); to fl…
Feb 7, 2018
243c382
Turn on/off the background grid render based on scale in viewport for…
Feb 19, 2018
7215528
Added the ability to set the tool tip for each node
Feb 20, 2018
7631c27
Merge branch 'master' of https://github.com/paceholder/nodeeditor
Feb 22, 2018
477d904
Made the signal and slot compatible for the setToolTip signal in the …
Feb 22, 2018
516ce86
Merge branch 'master' of https://github.com/paceholder/nodeeditor
Mar 14, 2018
bc9c58f
Added copy/paste between sheets
Jan 17, 2019
a0adb17
Started groups, added anchors, fixed position of nodes when pasting
jacquespillet Nov 1, 2019
02c5c7d
Added getter for history index, added resizing nodes
jacquespillet Nov 6, 2019
ddbe4a8
Started groups
jacquespillet Jan 6, 2020
4c2812f
continued groups
jacquespillet Apr 7, 2021
d341631
added deleted node
jacquespillet Apr 19, 2021
f6fb7b8
Added node templates
jacquespillet Aug 27, 2021
0eb037a
Fixes on groups
jacquespillet Sep 22, 2021
b91389b
Added snapping
jacquespillet Nov 15, 2021
51804f1
Added Collapsable group
jacquespillet Jan 26, 2022
d198287
Update view on geometry
jacquespillet Aug 8, 2022
a0318ec
Loading optimizations
jacquespillet Sep 22, 2022
54b5cf9
Optimized loading
jacquespillet Nov 21, 2022
410c823
started undoRedo
jacquespillet Nov 21, 2022
1c95c67
Merge branch 'master' of https://github.com/ScanLAB-Projects/nodeeditor
jacquespillet Nov 21, 2022
09d7926
progress on undo/redo system
jacquespillet Nov 22, 2022
8b041d4
UndoRedo for paste, duplicate and create connection
jacquespillet Dec 6, 2022
54c1f5b
fixed undo redo
jacquespillet Dec 9, 2022
c070645
added gotonode function
jacquespillet Nov 23, 2023
f5a177f
added go to node id
jacquespillet Jun 10, 2024
7e89261
added input colour to node
jacquespillet Sep 25, 2024
6f8c72d
fix crash
tomscanlab Sep 27, 2024
bdd4e90
crash fix
jacquespillet May 30, 2025
73ef40b
added node not found signal
jacquespillet Jun 3, 2025
42a5316
added action signal
jacquespillet Jul 7, 2025
21eee6e
Prevent duplicate connections in scene serialization
jacquespillet Jul 21, 2025
f0fada8
fixed line return on error messages
jacquespillet Sep 8, 2025
24c2a79
added placeholder nodes
jacquespillet Sep 18, 2025
4f62068
Merge branch 'refactor/json_funcs'
jacquespillet Sep 18, 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
Prev Previous commit
Next Next commit
continued groups
  • Loading branch information
jacquespillet committed Apr 7, 2021
commit 4c2812ff6e5a425889c46ce206fbfed8e2f80e1f
18 changes: 17 additions & 1 deletion include/nodes/internal/FlowScene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class NODE_EDITOR_PUBLIC FlowScene
void createGroup();

Node&restoreNode(QJsonObject const& nodeJson);

Group& restoreGroup(QJsonObject const& nodeJson);

QUuid pasteNode(QJsonObject &json, QPointF nodeGroupCentroid, QPointF mousePos);

Expand All @@ -89,6 +91,11 @@ class NODE_EDITOR_PUBLIC FlowScene
void setNodePosition(Node& node, const QPointF& pos) const;

QSizeF getNodeSize(const Node& node) const;

void resolveGroups(Group& node);

void resolveGroups(Node& n);

public:

std::unordered_map<QUuid, std::shared_ptr<Node> > const &nodes() const;
Expand Down Expand Up @@ -124,17 +131,26 @@ class NODE_EDITOR_PUBLIC FlowScene
signals:

void nodeCreated(Node &n);

void groupCreated(Group &g);

void nodeDeleted(Node &n);

void connectionCreated(Connection &c);

void connectionDeleted(Connection &c);

void nodeMoved(Node& n, const QPointF& newLocation);

void groupMoved(Group& n, const QPointF& newLocation);

void nodeMoveFinished(Node& n, const QPointF& newLocation);

void groupMoveFinished(Group& g, const QPointF& newLocation);

void nodeDoubleClicked(Node& n);

void groupDoubleClicked(Group& g);

void connectionHovered(Connection& c, QPoint screenPos);

Expand All @@ -158,7 +174,7 @@ class NODE_EDITOR_PUBLIC FlowScene
std::unordered_map<QUuid, SharedConnection> _connections;
std::unordered_map<QUuid, UniqueNode> _nodes;
std::shared_ptr<DataModelRegistry> _registry;
std::unordered_map<QUuid, std::unique_ptr<Group>> _groups;
std::unordered_map<QUuid, std::shared_ptr<Group>> _groups;

int historyInx;
bool writeToHistory;
Expand Down
65 changes: 56 additions & 9 deletions include/nodes/internal/Group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,99 @@
#include "NodeState.hpp"
#include "NodeGeometry.hpp"
#include "NodeData.hpp"
#include "NodeGraphicsObject.hpp"
#include "GroupGraphicsObject.hpp"
#include "ConnectionGraphicsObject.hpp"
#include "Serializable.hpp"
#include "Node.hpp"
namespace QtNodes
{

class GroupGraphicsObject;

class NODE_EDITOR_PUBLIC Group
: public QObject
, public Serializable
{
Q_OBJECT
public:
GroupGraphicsObject &
groupGraphicsObject() {
return *_groupGraphicsObject.get();
}

GroupGraphicsObject const &
groupGraphicsObject() const {
return *_groupGraphicsObject.get();
}

Group(FlowScene &scene): _scene(scene),
_id(QUuid::createUuid())
{
_groupGraphicsObject = std::make_unique<GroupGraphicsObject>(scene);
}
_id(QUuid::createUuid()),
_groupGraphicsObject(nullptr),
_name("New Group")
{ }

void AddNode(std::shared_ptr<Node> node) {
nodes.push_back(node);
}


void
setGraphicsObject(std::shared_ptr<GroupGraphicsObject> graphics) {
// _groupGraphicsObject = std::move(graphics);
_groupGraphicsObject = graphics;
}


virtual
~Group(){};

void SetName(QString _name);
QString GetName();

public:


QUuid
id() const;

QJsonObject save() const override{
QJsonObject object;
return object;
QJsonObject groupJson;
groupJson["name"] = _name;

QJsonObject posObj;
posObj["x"] = _groupGraphicsObject->pos().x();
posObj["y"] = _groupGraphicsObject->pos().y();
groupJson["position"] = posObj;

QJsonObject colObj;
colObj["r"] = _groupGraphicsObject->r;
colObj["g"] = _groupGraphicsObject->g;
colObj["b"] = _groupGraphicsObject->b;
groupJson["color"] = colObj;
return groupJson;
};

void restore(QJsonObject const &json) override{};
void restore(QJsonObject const &json) override{
_id = QUuid(json["id"].toString());

QJsonObject positionJson = json["position"].toObject();
QPointF point(positionJson["x"].toDouble(),
positionJson["y"].toDouble());
_groupGraphicsObject->setPos(point);

QJsonObject colorJson = json["color"].toObject();
_groupGraphicsObject->r = colorJson["r"].toInt();
_groupGraphicsObject->g = colorJson["g"].toInt();
_groupGraphicsObject->b = colorJson["b"].toInt();

_name = json["name"].toString();
};

std::shared_ptr<GroupGraphicsObject> _groupGraphicsObject;
QString _name;
private:

FlowScene & _scene;
std::unique_ptr<GroupGraphicsObject> _groupGraphicsObject;
std::vector<std::shared_ptr<Node>> nodes;

QUuid _id;
Expand Down
26 changes: 24 additions & 2 deletions include/nodes/internal/GroupGraphicsObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace QtNodes

class FlowScene;
class FlowItemEntry;
class Group;

/// Class reacts on GUI events, mouse clicks and
/// forwards painting operation.
Expand All @@ -23,17 +24,29 @@ class GroupGraphicsObject : public QGraphicsObject
Q_OBJECT

public:
GroupGraphicsObject(FlowScene &scene);
GroupGraphicsObject(FlowScene &scene, Group& group);

virtual
~GroupGraphicsObject();

Group&
group();

Group const&
group() const;


QRectF
boundingRect() const override;

void
setGeometryChanged();

/// Visits all attached connections and corrects
/// their corresponding end points.
void
moveConnections() const;

enum { Type = UserType + 1 };

int
Expand All @@ -42,6 +55,7 @@ class GroupGraphicsObject : public QGraphicsObject
void
lock(bool locked);

uint8_t r, g, b;
protected:
void
paint(QPainter* painter,
Expand Down Expand Up @@ -75,8 +89,16 @@ class GroupGraphicsObject : public QGraphicsObject
void
contextMenuEvent(QGraphicsSceneContextMenuEvent* event) override;


private:
FlowScene & _scene;
Group& _group;

bool isResizingX=false;
bool isResizingY=false;
bool isResizingXY=false;

int sizeX=1000;
int sizeY=1000;

};
}
Loading