Repository navigation
Fix node moves, locks and group crashes (3.x) - #542
Merged
Merged
Conversation
paceholder
force-pushed
the
fix/model-driven-node-move
branch
2 times, most recently
from
November 22, 2026 16:48
d90b26f to
d347d46
Compare
Since the node group commit, dragging a node let Qt move the item and never told the model, so NodeRole::Position stayed at the old value. Saved positions, setNodeData overrides and nodeMoved saw stale data, and a drag was not undoable. Restore the original flow: mouseMoveEvent pushes a MoveNodeCommand and the scene follows the model signals. MoveNodeCommand gets a constructor taking explicit node ids, so group dragging can move the group's nodes plus any selected nodes. GroupGraphicsObject::moveNodes writes to the model without an undo command. Remove the branch that moved the nodes of a locked group without an undo command. A locked group is dragged through its own item. Reset the drag flag of the scene on mouse press. A position set from code or by undo no longer makes the next plain click emit nodeMoved. Add tests that drag a node and a group with simulated mouse events and check model positions, the nodeMoved signal and undo/redo. Fixes #525 Fixes #526 Refs #533
The v1 and v2 branches are being removed. Their history is reachable from tags 1.0 and 2.2.4, so refer to those instead of the branches.
The sources already use C++17 (if with initializer, structured bindings) and Qt 6 requires it. Declare it for developer builds, inside the developer-defaults block, and state it in the README. QtNodes does not impose a standard on projects that include it. They set their own, so that all of their targets stay consistent. Refs #516
AGENTS.md holds the guidance for coding agents: writing style, build and test commands, architecture, code style, C++ standard policy, test and docs rules, and commit and release rules. CLAUDE.md imports it.
.claude/ holds personal agent settings and worktrees. openspec/ is the maintainer's local planning space.
The node group commit replaced the NodeFlag::Locked check in mousePressEvent with the group lock only. A model-locked node could start a draft connection or detach a connection again. The model lock and the group lock also wrote the same item flags. Unlocking a group made a model-locked node selectable, and a flags update made a node of a locked group selectable. setLockedState now sets the flags from both locks, and lock() calls it. Fixes #536
A model reset left the groups in the scene. The nodes were deleted first and clear() deleted the group items, which the groups still owned. The next use or the destruction of the scene deleted them again. Drop the groups before anything is cleared. addNodeToGroup did not check the current group of the node. The node was listed twice in the same group, or stayed in the old group too. Return if it is already a member, otherwise remove it from the old group first. A group had the scene as QObject parent and also a shared_ptr, so it had two owners. The scene also deleted the group items that the groups owned. Create the group without a parent. The scene destructor releases the group items while the scene is alive. The undo and redo of a move skip nodes that no longer exist. Fixes #540
The docs said that node groups are not implemented. They exist since 3.1.4. Say how to enable them. Add a page that lists the known problems of groups in 3.x and explains why they are fixed in v4 and not in 3.x. Refs #539
paceholder
force-pushed
the
fix/model-driven-node-move
branch
from
November 22, 2026 16:49
d347d46 to
873a1e7
Compare
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Bug fixes for 3.x. No public API is removed or changed.
mouseMoveEventpushes aMoveNodeCommand, and the scene follows the model signals. Since the node group commit (3.1.4), only the graphics item moved.nodeMovedwas not emitted,setNodeDatawas not called and the saved position was wrong.MoveNodeCommandhas a new constructor that takes node ids, so a group can move its nodes.docs/migration/v3-to-v4.rst. It lists the known limits of groups in 3.x and why they are fixed in v4 (Move node groups into the model (next major version) #539). The FAQ no longer says that groups do not exist.#533 fixes the same move bug by syncing the graphics position into the model. This PR restores the original flow instead, where the model changes first.
Testing
Each fix has a test that fails without it.
Breaking changes?
None.
PasteCommandhas a private member that is now a value and not a reference. This changes the class layout, but not the API.Related issue
Fixes #525. Fixes #526. Fixes #536. Fixes #540.
Refs #516, #533, #539.