Skip to content

Keep the graphics objects when the scene orientation changes - #567

Merged
paceholder merged 1 commit into
masterfrom
fix-orientation-widgets
Nov 29, 2026
Merged

paceholder merged 1 commit into
masterfrom
fix-orientation-widgets

Conversation

@paceholder

@paceholder paceholder commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Type of change

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

Description

BasicGraphicsScene::setOrientation() called onModelReset(). That deleted every graphics object and built them again. The node proxies deleted the embedded widgets, and the groups and the selection were lost. A model with a raw pointer to its widget then had a dangling pointer and crashed.

Only the geometry changes. setOrientation() now switches the geometry and calls onNodeUpdated() for each node.

The reset path stays, because a custom model can still emit modelReset().

The test "A model reset with a group does not leave dangling group items" is about that reset, not about the orientation. It used setOrientation() only to cause a reset. Now setOrientation() does not reset, so the test emits modelReset() directly. It checks the same thing as before.

Not checked: a rendered vertical layout (connections, ports and group boxes), and the minimum height of an expanding widget after the switch. The question of swapping the X and Y positions is not part of this change.

Testing

  • Qt version tested: 6 (offscreen). CI covers Qt5.
  • Existing tests still pass
  • Added tests for new functionality: the widget keeps its text after the switch, and the groups and the selection stay. Both tests fail without the fix.

Breaking changes?

No.

Related issue

Fixes #466

The scene reset itself and deleted every graphics object. The node proxies deleted the embedded widgets, and the groups and the selection were lost. The models kept pointers to the deleted widgets.

Only the geometry changes, so the scene now updates each node.

Fixes #466
@paceholder
paceholder merged commit bb2c060 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.

change of orientation when the nodes have embedded WIdgets

1 participant