Repository navigation
Decide the drag into a group from the current node position - #579
Merged
Merged
Conversation
A node dragged over a group left the group only when a later move still collided with the group. A move that took the node far away in one step kept the old state, and the node joined the group at the release. The node now checks on each move whether it still touches the group, and the release always clears the drag state. The group is held in a QPointer, so a group deleted during the drag is not used at the release. See #537
The test drags the resize handle of a resizable node with an embedded widget. The node belongs to a group. After the drag the box of the group must still contain the larger node. This covers the updateGroupGeometry() call in the resize branch of NodeGraphicsObject::mouseMoveEvent().
MoveNodeCommand::beginMove() was added without a mention in the undo guide. The guide now says that the moves of one drag merge, that a mouse press starts a new move, and that code which pushes the command itself must call beginMove(). The migration page narrows the warning about loadItems() with a paste position to pasted groups.
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
Two bugs in the drag of a node over a node group (#537, item 2):
collidingItems(), so a move that left the group never reached it, and the release used the stale state._possibleGroupwas a raw pointer that the release used after the group was deleted. The test for this crashed with SIGSEGV on the old code.The node now checks on each move whether it still touches the group (as the box was before it grew to show the node), and the release always clears the state.
_possibleGroupis aQPointer._draggingIntoGroupis removed, because it duplicated the pointer. There is no new public function.Three commits:
mouseMoveEvent(added in Fix the gaps in the change notifications of the scene and the model #575) had no test. The test fails when the call is removed.MoveNodeCommand::beginMove()in the undo guide, which Make each drag of a node one undo step #573 added without a mention. The moves of one drag merge, a mouse press starts a new move, and code that pushes the command itself must callbeginMove().Testing
Not tested: Qt 5, Linux, Windows, a real GPU window, an ASAN build.
Breaking changes?
No API change. Two private members of
NodeGraphicsObjectchange type (abooland a raw pointer become aQPointer). I measured thatsizeofstays the same (16 bytes for both), so the layout of the class does not change. A class that derives fromNodeGraphicsObjectneeds a rebuild.Not in this PR
Issue #537 stays open. Item 3 (the offset of a pasted group, because the group item is always at (0,0)) needs a decision on what a paste position means for a group.
GroupGraphicsObject::_possibleChildis still a raw pointer, and it dangles if a node is deleted while it is dragged over a group. I did not reproduce that case.Related issue
See #537.