Proposal: use QDockWidget for Leo's main window

42 weergaven
Naar het eerste ongelezen bericht

Edward K. Ream

ongelezen,
19 mei 2019, 11:23:5819-05-2019
aan leo-editor
This post discusses #1150.  Don't panic.  Nothing is settled yet, and I'll consider your comments seriously.

Using Qt's Dock widget might improve Leo substantially.  It would certainly making integrating Leo and pyzo easier, but that's a secondary concern.  The proposal must stand on its own merits.

Background

Using a Dock might seem a no-brainer.  Qt docks allow users freedom to position, move and resize dockable widgets. Even better, Qt can automagically save and restore user changes!

Alas, QDock's require a so-called central widget.  This significantly restricts the design choices.  Everything must be placed around the central widget: above, below, left or right of it.

Pyzo is a good example of Qt's dock.  Please play around with it to get a feel for how it works. In pyzo, the central widget holds a tabbed widget containing all the user's files (pyzo editors).

The proposal

The obvious thing to do would be to put Leo's entire main window into the central widget. This would work, but I think there is a better way:

    Remove Leo's Tab Pane from the main window

I think this makes sense! The benefits:

- More freedom to arrange and size components of the Tab Pane.
- Greater width for the tree pane, when the tree appears above the body pane.
- One less splitter in the main window.

In addition to the benefits of using a top-level QDockWidget mentioned above, Leo will need neither the Easter Egg interface nor the nested splitter machinery. Plugins will simply create dockable widgets.  I am prepared to do the retro-fitting.

I don't see any major drawbacks. Without additional changes, multiple body panes will work just as before. However, we could imagine additional body panes placed as dockable widgets outside the main window.  This seems like another advantage of the proposal.

BTW, Leo will likely still support the toggle-split direction command.  Its effect will be simpler.

Summary

Imo, it makes sense to remove Leo's Log Pane from Leo's main window when using a top-level QDockWidget.  I see no significant drawbacks to doing so.  It will require significant behind-the scenes work, which will be my responsibility.

These are early days for this proposal.  Please let me know what you think.

Edward

Terry Brown

ongelezen,
19 mei 2019, 11:29:1419-05-2019
aan leo-e...@googlegroups.com
On Sun, 19 May 2019 08:23:58 -0700 (PDT)
"Edward K. Ream" <edre...@gmail.com> wrote:

> This post discusses #1150
> <https://github.com/leo-editor/leo-editor/issues/1150>. Don't
> panic. Nothing is settled yet, and I'll consider your comments
> seriously.
>
> Using Qt's Dock widget *might* improve Leo substantially. It would
> certainly making integrating Leo and pyzo easier, but that's a
> secondary concern. The proposal must stand on its own merits.
>
> *Background*
>
> Using a Dock might seem a no-brainer. Qt docks allow users freedom
> to position, move and resize *dockable *widgets. Even better, Qt can
> automagically save and restore user changes!

To layout, not the state of the widget in the dock.

> Alas, QDock's require a so-called *central widget*. This
> significantly restricts the design choices. Everything must be
> placed *around* the central widget: above, below, left or right of it.

When I was trying to do this it seems sufficient to just use the left
side dock for everything, and have no main widget. That gives you
complete freedom of layout and no "more equal than others" widget.

Cheers -Terry

> Pyzo is a good example of Qt's dock. Please play around with it to
> get a feel for how it works. In pyzo, the central widget holds a
> tabbed widget containing all the user's files (pyzo editors).
>
> *The proposal*
>
> The obvious thing to do would be to put Leo's *entire* main window
> into the central widget. This would work, but I think there is a
> better way:
>
> *Remove Leo's Tab Pane from the main window*
>
> I think this makes sense! The benefits:
>
> - More freedom to arrange and size components of the Tab Pane.
> - Greater width for the tree pane, when the tree appears above the
> body pane.
> - One less splitter in the main window.
>
> In addition to the benefits of using a top-level QDockWidget
> mentioned above, Leo will need neither the Easter Egg interface nor
> the nested splitter machinery. Plugins will simply create dockable
> widgets. I am prepared to do the retro-fitting.
>
> I don't see any major drawbacks. Without *additional* changes,
> multiple body panes will work just as before. However, we could
> imagine additional body panes placed as *dockable* widgets outside
> the main window. This seems like another advantage of the proposal.
>
> BTW, Leo will likely still support the toggle-split direction
> command. Its effect will be simpler.
>
> *Summary*

Edward K. Ream

ongelezen,
19 mei 2019, 19:02:0819-05-2019
aan leo-editor
On Sun, May 19, 2019 at 10:29 AM Terry Brown <terry...@gmail.com> wrote:

When I was trying to do this it seems sufficient to just use the left
side dock for everything, and have no main widget.  That gives you
complete freedom of layout and no "more equal than others" widget.

Great!  I'll try it out next.

Edward

Edward K. Ream

ongelezen,
19 mei 2019, 19:31:3019-05-2019
aan leo-editor
On Sun, May 19, 2019 at 10:29 AM Terry Brown wrote:

> When I was trying to do this it seems sufficient to just use the left side dock for everything, and have no main widget.  That gives you complete freedom of layout and no "more equal than others" widget.

Heh.  All that's needed for "equality" of widgets is not specifying a central widget.  See this example script. It shows widgets in both the left and right areas.

This is great news.

Edward
Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten