On Sun, Sep 1, 2024 at 9:36 PM Thomas Passin wrote: > This Engineering Notebook discusses a script-based approach to changing > and restoring the arrangement of Leo's panes, including the body editor, > the nav pane, the Viewrendered and Viewrendered3 plugins' panes, and > potentially others.
... > In the case of user widgets, there is no general way to destroy them, and > if it's not done right, Leo's event system will stay hooked up to the > remains of a dead widget. > ... > The solution is to add a new, hidden QWidget to the main splitter. It acts > as a place to store hidden and unused widgets. This cache widget will never > become visible, and it will never get lost because there must always be a > main splitter. A widget can be removed from its location simply by changing > its parent to the cache widget. Qt will handle all the bookkeeping when we > move a widget into and out of the cache so we don't have to write *any* > caching code ourselves. The widgets will remain hidden but whole and > active, ready to be relocated from the cache to a new layout at any time. > > With this idea, it becomes feasible to find and cache all user objects (I > mean ones that are not PyQt widgets) whether we know anything about them or > not. They just have to have an objectName, so if they have been cached > they can be found and put into a layout. > Well done, Thomas. "Making the simple complicated is commonplace; making the complicated simple, awesomely simple, that's creativity"--Charles Mingis Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS2BY%3D1dzRDTEeUpJxFCZDiSOcxZz%2Bfv8QhMY%2B5Tvoi%2BVQ%40mail.gmail.com.