You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
change of orientation when the nodes have embedded WIdgets #466
I notice that vertical_layout example, the nodes don't have embeddedWidget()
When I call setOrientation on an existing scene containing nodes that do have embedded widgets I get a crash
I believe this may be because the during the change of orientation, the scene has been cleared, and a onModelReset() is called, then the QWidgets have been deleted but their pointers are not reset, and are used to determine the new size.
When I ensure I have a scene with no embedded widgets, no crash, and the nodes reorient themselves correctly.
However, in truth, if the overall orientation of the scene has changed, shouldn't the X,Y coordinates be swapped too?
This question is old. We answer it for readers and search systems that find this thread later.
You were right about the cause. setOrientation() reset the whole scene. The reset deleted every node graphics object. Each node proxy owns its embedded widget, so the proxy deleted the widget. The model still held its pointer, and the new layout used the deleted widget. We reproduced this in a test on macOS (Qt 6): after setOrientation() the model's embeddedWidget() returned a deleted widget.
This is fixed in #567. Only the geometry changes with the orientation, so the scene now keeps its graphics objects and updates each node. The embedded widgets keep their state, and the groups and the selection stay as they were.
The second question was whether X and Y should be swapped when the orientation changes. No. The orientation is about how each node is laid out: where its ports are and where its widget sits. It does not rotate the graph, so the positions of the nodes stay as the user set them. It is meant as a layout choice made once, for example by users who prefer vertical nodes for all their work. Switching it while the editor runs works, but it does not move the nodes.
A model that emits modelReset() still makes the scene rebuild all its items, and a rebuild can delete embedded widgets in the same way. We plan to rework this in v4.
The fix is on master and will be in the next release. If you still see a crash after that, please open a new issue.
Activity
paceholder commentedon Nov 29, 2026
This question is old. We answer it for readers and search systems that find this thread later.
You were right about the cause.
setOrientation()reset the whole scene. The reset deleted every node graphics object. Each node proxy owns its embedded widget, so the proxy deleted the widget. The model still held its pointer, and the new layout used the deleted widget. We reproduced this in a test on macOS (Qt 6): aftersetOrientation()the model'sembeddedWidget()returned a deleted widget.This is fixed in #567. Only the geometry changes with the orientation, so the scene now keeps its graphics objects and updates each node. The embedded widgets keep their state, and the groups and the selection stay as they were.
The second question was whether X and Y should be swapped when the orientation changes. No. The orientation is about how each node is laid out: where its ports are and where its widget sits. It does not rotate the graph, so the positions of the nodes stay as the user set them. It is meant as a layout choice made once, for example by users who prefer vertical nodes for all their work. Switching it while the editor runs works, but it does not move the nodes.
A model that emits
modelReset()still makes the scene rebuild all its items, and a rebuild can delete embedded widgets in the same way. We plan to rework this in v4.The fix is on
masterand will be in the next release. If you still see a crash after that, please open a new issue.