You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move node groups into the model (next major version) #539
Add NodeRole::Group. The value is a GroupId, or InvalidGroupId. Append it to the enum.
A group is the set of nodes with the same GroupId. The scene derives it from the model.
Group data (name, locked) has its own model calls, like groupData(GroupId, GroupRole). The model creates group ids, like it does for node ids.
GroupGraphicsObject stays as a view. It draws a rectangle from the member nodes and owns no relation.
Remove NodeGroup and the shared_ptr / weak_ptr links. Remove NodeGroup::saveToFile.
Remove GroupGraphicsObject::setPosition. It has no callers and moves the nodes by position, not to it.
Create, add, remove and ungroup become undo commands that write the model.
A small helper class, held as a member by model classes, does the group bookkeeping. Model authors do not rewrite it. A model without it has no groups.
The scene JSON keeps the "groups" array, so old files still load.
Decisions so far:
No nesting, no folding. One group per node.
Qt parent-child between the group item and the nodes is not used. A child pos() is relative to the parent, but the model stores scene positions.
A frame that finds its nodes by geometry is not used. With overlapping frames, a node has no clear owner.
Problem to be solved
Group state lives only in the scene. Membership, lock and name are not in the model. They are not undoable and DataFlowGraphModel::save does not write them. NodeGroup holds raw NodeGraphicsObject * pointers. It is a QObject, but it uses no signal or property. The pointers are behind several bugs (stale pointers, undo that loses groups).
The library rule is: the model is the source of truth and the scene follows its signals. Groups should follow it too.
Prior art
No response
Additional context
This removes public API (NodeGroup, childNodes()). It is for the next major version. I will collect other breaking changes for the same release.
Open:
The exact model API and the helper class.
What DataFlowGraphModel::save writes.
How undo commands save and restore group data.
The drag of a group does not emit nodeMoved. This needs a design too, because onNodeClicked clears its flag after the first node.
Checklist
I have verified that this feature request has not been logged before, by searching the issue tracker for similar requests
Activity