Panel spacer that can center things
ClosedPublic

Authored by mart on Feb 18 2020, 3:44 PM.

Details

Summary
  • Make the panel spacer take a lot more space when is in expanding mode, so much

to "win" against the taskbar and collapse it to its minimum size (seems the
most expected behavior after some discussions in vdg channel)

  • make it paint a background when in edit mode
  • when two spacers are present in the panel, they try to center all the content

that is in between them (if possible), so that is always at the center of the panel,
even if there is more content on one side rather than the other

Test Plan


Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mart created this revision.Feb 18 2020, 3:44 PM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 18 2020, 3:44 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart requested review of this revision.Feb 18 2020, 3:44 PM
mart edited the test plan for this revision. (Show Details)Feb 18 2020, 3:45 PM
mart added a comment.Feb 18 2020, 3:48 PM

Implementation-wise could make sense for the implementation be in the panel itself, tough it may be difficult to control from the external panel configuration tool

Usability-wise i think would be fine if the first spacer is added at the end of the panel, and the second at the beginning, trigering the centering for the whole panel contents, tough again is a bit difficult to trigger from the external panel configuration toolbar

Super cool feature! This was one of the things I was missing for D24223.

broulik added inline comments.
applets/panelspacer/package/contents/config/main.xml
15

Please mention in the label what -1 means

applets/panelspacer/package/contents/ui/main.qml
31

Why that?

69

Could be a Qt.binding?

78

Does Qt.callLater(foo) work? It also compresses subsequent calls to the same method (i.e. doesn't work with a closure)

96

Please cache panelLayout.children[i] in a variable to make the code below somewhat more readable

mart updated this revision to Diff 75980.Feb 19 2020, 11:46 AM
mart marked 3 inline comments as done.
  • use a binding
  • use twinlayouts only when both are expanding
mart added inline comments.Feb 19 2020, 11:47 AM
applets/panelspacer/package/contents/ui/main.qml
31

no idea, is from the old applet and appears useless (also phab gets confused and doesn't understand the move of main.qml to a subfolder)

78

yep, works

mart marked an inline comment as done.Feb 19 2020, 11:47 AM
mart updated this revision to Diff 75988.Feb 19 2020, 12:43 PM
  • put the second spacer at the beginning
mart added a comment.Feb 19 2020, 12:45 PM

demo of adding 2 spacers and centering mode

mart retitled this revision from [WIP]Panel spacer that can center things to Panel spacer that can center things.Feb 19 2020, 12:45 PM
mart updated this revision to Diff 75990.Feb 19 2020, 12:56 PM
  • bigger in edit mode

I think the deisgn og the spacer could be better in edit mode to clearly mark it as a spacer but that can be done in the future if desired.

Yeah it would be nice to call this an "Expanding spacer" or something like that. That's the term that we use for the rough equivalent for KXMLGui toolbars.

I think the deisgn og the spacer could be better in edit mode to clearly mark it as a spacer but that can be done in the future if desired.

An idea could be to display something similiar to the icon on the "Add spacer" button on then or an arrow on each side

mart added a comment.Feb 19 2020, 3:30 PM

I think the deisgn og the spacer could be better in edit mode to clearly mark it as a spacer but that can be done in the future if desired.

An idea could be to display something similiar to the icon on the "Add spacer" button on then or an arrow on each side

any further change in design of the edit more graphics should be in a separate patch, it's besides the point here

mart added a comment.Feb 20 2020, 10:22 AM

I think the deisgn og the spacer could be better in edit mode to clearly mark it as a spacer but that can be done in the future if desired.

An idea could be to display something similiar to the icon on the "Add spacer" button on then or an arrow on each side

yeah, i was planning on something quite simple, like H looking
anyways, the spacer should probably become a Loader and have all the edit mode graphics loaded only then (otherwise, empty loader)

mart edited the test plan for this revision. (Show Details)Feb 20 2020, 10:24 AM
davidedmundson added inline comments.
shell/panelconfigview.cpp
115

why is this a script?

mart added inline comments.Feb 20 2020, 10:32 AM
shell/panelconfigview.cpp
115

so, i need to add the second spacer at first position rather than the last.
I don't think i can do this without a script, as i need to access the qquickitem to actually set a position (well, i could by accessing the graphics object property,directly, like the script implementation is doing, but it would be uglier

mart added a comment.Feb 20 2020, 11:13 AM

I think the deisgn og the spacer could be better in edit mode to clearly mark it as a spacer but that can be done in the future if desired.

An idea could be to display something similiar to the icon on the "Add spacer" button on then or an arrow on each side

yeah, something along the lines (either one of those different two)

That looks nice!

davidedmundson added inline comments.Feb 25 2020, 2:36 PM
applets/panelspacer/package/contents/config/main.xml
15

this needs doing

applets/panelspacer/package/contents/ui/main.qml
110

If we're trying to recreate the size hint of RowLayout we need to include maximum size hints

shell/panelconfigview.cpp
115

Seems like Panel could benefit from some sort of...ContinamentLayoutManager?

Effectively we're evaluating what RowLayout evaluates by hand here anyway, it seems like the right path forward and worth investing time in. Though it can happen after this patch.

mart updated this revision to Diff 76369.Feb 25 2020, 2:54 PM
  • take maximum size into account
  • document -1
mart marked 7 inline comments as done.Feb 25 2020, 2:54 PM
mart added inline comments.
shell/panelconfigview.cpp
115

indeed.

davidedmundson accepted this revision.Feb 25 2020, 2:58 PM
This revision is now accepted and ready to land.Feb 25 2020, 2:58 PM
This revision was automatically updated to reflect the committed changes.