Skip to content

Fix Backspace in embedded widgets and the selection after undo of a delete - #564

Merged
paceholder merged 2 commits into
masterfrom
fix-node-keys-and-undo-selection
Nov 29, 2026
Merged

paceholder merged 2 commits into
masterfrom
fix-node-keys-and-undo-selection

Conversation

@paceholder

Copy link
Copy Markdown
Owner

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation/refactoring

Description

Two small bugs in the undo and key handling of the graphics layer.

  1. Give Backspace and Delete to a focused embedded widget first. GraphicsView::keyPressEvent handled Delete, and Backspace on macOS, before the scene saw the key. A focused line edit in a node lost the key, and the selected nodes were deleted instead. The view now passes the key on when the scene focus item is an embedded widget. The guard covers every key of the switch, so F2 (rename the label) does not fire while an embedded widget has the focus. Clicking into a field still does not select its node. That is unchanged.
  2. Do not select the connections restored by the undo of a delete. The undo of a delete selected every restored node and connection. The restore function is shared with paste, where this is wanted. insertSerializedItems() has a new flag, selectConnections. Paste passes true. The undo of a delete passes false, so the restored nodes are selected, as they were before the delete, and their connections are not. A connection that was selected explicitly before the delete also comes back unselected.

Each commit builds and passes on its own. Each has its test.

Testing

  • Qt version tested: Qt 6.12.0, macOS arm64 (Apple Clang), offscreen platform
  • Existing tests still pass (929 assertions in 90 test cases)
  • Added tests for new functionality
  • Checked that the new tests fail without the fixes: the key test leaves the text unchanged and deletes a node, and the undo test finds the restored connections selected. The fix of the key handling was also tried by hand in the calculator on macOS.
  • Not tested: Qt 5, Windows, Linux. CI covers them.

Breaking changes?

No.

Related issue

Fixes #562
Fixes #563

GraphicsView handled Backspace (on macOS) and Delete before the scene saw
the key. A focused line edit in a node lost the key and the selected nodes
were deleted instead.

Fixes #562
Undo of a delete selected every restored node and connection. The restore function is shared with paste, where this is wanted. Before the delete, selecting a node did not select its connections. Select only the nodes in the undo.

Fixes #563
@paceholder
paceholder merged commit 1744f02 into master Nov 29, 2026
5 checks passed
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.

Undo of a delete selects the restored connections Backspace in an embedded text field deletes the selected node

1 participant