Skip to content

GraphEditor: allow graph pan while connecting attributes via edge drag#3043

Draft
Copilot wants to merge 3 commits intodevelopfrom
copilot/fix-floating-edge-creation
Draft

GraphEditor: allow graph pan while connecting attributes via edge drag#3043
Copilot wants to merge 3 commits intodevelopfrom
copilot/fix-floating-edge-creation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

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, and GraphEditor:

  1. Floating edge bugonReleased in both inputConnectMA and outputConnectMA now calls Drag.cancel() for non-left-button releases; onCanceled also cancels the drag instead of dropping.
  2. Pan during edge drag – Middle-button press during edge drag is now consumed by the pin's own MouseArea (via acceptedButtons: Qt.LeftButton | Qt.MiddleButton), preventing grab-stealing. Mouse movement while middle button is held emits panRequested(dx, dy) with a screen-space delta, bubbled up through Node to GraphEditor which applies it directly to draggable.x/y.

Features list

  • Fix floating edge created when middle mouse button is clicked during edge drag
  • Allow graph panning with middle mouse button while dragging an edge to connect attributes

Implementation remarks

Pan delta is computed in global (screen) coordinates via mapToGlobal() to avoid coordinate-system distortion from the scaled draggable container. The panRequested(real dx, real dy) signal is propagated through the AttributePin → Node → GraphEditor chain and applied as draggable.x += dx; draggable.y += dy.

Because the same MouseArea now owns both the left-button drag and the middle-button pan, the edge drag is never interrupted: drag.target continues tracking the mouse for the left button while pan deltas are emitted independently on position changes when pressedButtons & 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.

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
Copilot AI requested a review from fabiencastan March 15, 2026 02:51
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants