tuli
8th September 2012, 07:46
hi,
in one application, we are using QDockWindows to show different aspects/data of a loaded file.
The user can choose to create as many DockWidgets of the various available DOckWidgets, and he can place them where he likes.
The problem now is what to do when the user opens a new file.
In that case, the old content would have to be discarded and new content displayed,
without the docking arrangement being destroyed.
ATM, the docking widgets get their data from a single pointer to a file-instance.
it would be straight forward to zero that pointer, and simply assign one to the new instance. But how?
1)
a global signal UpdatePtr could be sent to all dockwidgets.
Not sure about that one. Would
emit UpdatePtr(newptr);
delete oldptr;
leave everyone enought time to really discard the old ptr?
2)
a global function that returns a ptr. That way, we would have to update one ptr instance only.
Not really a fan of global functions.
In either case, what do you think?
in one application, we are using QDockWindows to show different aspects/data of a loaded file.
The user can choose to create as many DockWidgets of the various available DOckWidgets, and he can place them where he likes.
The problem now is what to do when the user opens a new file.
In that case, the old content would have to be discarded and new content displayed,
without the docking arrangement being destroyed.
ATM, the docking widgets get their data from a single pointer to a file-instance.
it would be straight forward to zero that pointer, and simply assign one to the new instance. But how?
1)
a global signal UpdatePtr could be sent to all dockwidgets.
Not sure about that one. Would
emit UpdatePtr(newptr);
delete oldptr;
leave everyone enought time to really discard the old ptr?
2)
a global function that returns a ptr. That way, we would have to update one ptr instance only.
Not really a fan of global functions.
In either case, what do you think?