Repository navigation
Conversation
StDarton
left a comment
There was a problem hiding this comment.
Didn't look at the code, but tested locally - the bug is completely gone. Now nodes positions save as it should. This was such a frustrating issue, let's merge this quickly!
|
Thank you for the PR, and for the tests. Thanks also to @StDarton for trying it. I fixed the same bug a bit differently, so I will not merge this one. In QtNodes the model is the source of truth and the scene follows its signals. Before 3.1.4 the mouse move pushed a The fix is ready and has tests that check model positions, Your tests for dragging and for save and load are useful. If you like, open a new PR with only the tests on top of the release. I would be happy to look at it. |
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. Export GroupGraphicsObject. NodeGroup::groupGraphicsObject() returns it in the public API, and the tests call its lock(). Without the export, the tests do not link on a Windows shared build. 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
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
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
|
3.1.8 is out with the fix from #542. Thanks again for the tests. |
Type of change
Description
Moving nodes updates their graphics without storing the new model coordinates or emitting the completed-move signal. Synchronize graphical position changes with the model, avoiding duplicate updates when the model initiates the move.
Testing
Qt version tested: 6.11.2. Eleven regression assertions fail on unchanged upstream; 37 selected tests (448 assertions) pass after the fix. The library, all configured examples and changed-code formatting checks pass.
Breaking changes?
None.
Related issue
Fixes #525. Fixes #526.