GraphEditor: allow graph pan while connecting attributes via edge drag#3043
Draft
GraphEditor: allow graph pan while connecting attributes via edge drag#3043
Conversation
When creating an edge by dragging from an attribute pin (holding left mouse button) and pressing middle mouse button to navigate, the QML event system could steal the mouse grab (triggering onCanceled) or fire a spurious onReleased. Both cases called Drag.drop() unconditionally, creating a floating edge. Fix: - In inputConnectMA/outputConnectMA onReleased: only call Drag.drop() on left button release; call Drag.cancel() for other buttons - Add onCanceled handlers that call Drag.cancel() to clean up properly when the mouse grab is stolen (e.g. by middle button navigation) Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix floating edge creation during attribute connection
Fix floating edge created when middle-clicking during edge drag in GraphEditor
Mar 15, 2026
…utes Co-authored-by: fabiencastan <153585+fabiencastan@users.noreply.github.com>
Copilot
AI
changed the title
Fix floating edge created when middle-clicking during edge drag in GraphEditor
GraphEditor: allow graph pan while connecting attributes via edge drag
Mar 15, 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.
Pressing the middle mouse button during an edge drag (left-button hold on an attribute pin) was stealing the mouse grab, causing a spurious
Drag.drop()and leaving a floating edge in the graph. Additionally, there was no way to pan the graph while a connection was in progress.Description
Two related fixes to
AttributePin,Node, andGraphEditor:onReleasedin bothinputConnectMAandoutputConnectMAnow callsDrag.cancel()for non-left-button releases;onCanceledalso cancels the drag instead of dropping.MouseArea(viaacceptedButtons: Qt.LeftButton | Qt.MiddleButton), preventing grab-stealing. Mouse movement while middle button is held emitspanRequested(dx, dy)with a screen-space delta, bubbled up throughNodetoGraphEditorwhich applies it directly todraggable.x/y.Features list
Implementation remarks
Pan delta is computed in global (screen) coordinates via
mapToGlobal()to avoid coordinate-system distortion from the scaleddraggablecontainer. ThepanRequested(real dx, real dy)signal is propagated through theAttributePin → Node → GraphEditorchain and applied asdraggable.x += dx; draggable.y += dy.Because the same
MouseAreanow owns both the left-button drag and the middle-button pan, the edge drag is never interrupted:drag.targetcontinues tracking the mouse for the left button while pan deltas are emitted independently on position changes whenpressedButtons & Qt.MiddleButton.📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.