KDAB / KDDockWidgets

KDAB's Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets
Other
754 stars 163 forks source link

Recycling dock widgets from the factory #443

Closed OlivierJG closed 9 months ago

OlivierJG commented 9 months ago

Given a saved layout which will deserialize in this order: "Dock1" "Dock2" ... and a factory function which will return a dock widget named "Dock2" for the uniqueName "Dock1"

KDDW will first correctly place the DockWidget named "Dock2" in the position of "Dock1" (remapping), but then when it attempts to find the dock widget to place in the position of "Dock2" it will not consult the factory function. Instead it will place the already-placed dock widget in a second place (and crash).

In order to support transparently reassigning interchangable dock widgets, it might make sense for the remapping to update the uniqueName of the dock widget? Or not directly iterate through dock widgets when deserializing (dock registry)?

Alternatively this use case could be unsupported, and dock widgets will always need to be created to match the given name to avoid the possibility of aliasing.

iamsergio commented 9 months ago

commit a71e55e8fffb5d6f52f6d11635ccdb2c11b9b13a (HEAD -> main, origin/main) Author: Sergio Martins sergio.martins@kdab.com Date: Fri Nov 24 18:45:53 2023 +0000

Expose DockWidget::Private::setUniqueName() in the controller