Repository navigation
Description
Your idea
Proposal:
- Add
NodeRole::Group. The value is aGroupId, orInvalidGroupId. 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. GroupGraphicsObjectstays as a view. It draws a rectangle from the member nodes and owns no relation.- Remove
NodeGroupand theshared_ptr/weak_ptrlinks. RemoveNodeGroup::saveToFile. - Remove
GroupGraphicsObject::setPosition. It has no callers and moves the nodes byposition, 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::savewrites. - 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