[kcm/kwinrules] Fix layout misalignment of list items
ClosedPublic

Authored by iasensio on May 4 2020, 6:09 PM.

Details

Summary

Remove anchors within Kirigami.AbstractListItem delegates.
They were causing random misalignment of items in the main and the overlay ListViews

Test Plan

Before


After

Diff Detail

Repository
R108 KWin
Branch
fixlayout
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26346
Build 26364: arc lint + arc unit
iasensio created this revision.May 4 2020, 6:09 PM
Restricted Application added a project: KWin. · View Herald TranscriptMay 4 2020, 6:09 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
iasensio requested review of this revision.May 4 2020, 6:09 PM
ngraham added a subscriber: ngraham.May 4 2020, 6:50 PM

In the After views, there appear to be extra/excessive left and right margins compared the the Before images, which look more correct to me.

iasensio added a comment.EditedMay 4 2020, 7:31 PM

In the After views, there appear to be extra/excessive left and right margins compared the the Before images, which look more correct to me.

There are more margins indeed. The anchor was also taking the margins from the RowLayout itself (only sometimes, hence the visual bug before)

On the left side (a Kirigami.Icon), I introduced extra margins to compensate. This is how it looks without them:

On the right side, there's a QQC2.Button, and what it seems to be a 1px extra margin to the right

That, and the button being only visible on hover makes the right part look more empty, so I though of keeping the extra margins on the left icon. I could also add negative margins on the right button (maybe too hackish?):

The extra margins for icon items don't bug me, but I think it's weird for the items that have a visible frame to have visibly greater left or right margins than top+bottom margins.

iasensio updated this revision to Diff 82018.May 5 2020, 7:38 PM
  • Remove extra margins on left icon
  • Add negative margins on right button

With this we get:

Your thought, @ngraham, @broulik?

LGTM, at least that part! Is it new that the section headers are escaping from the sheet by one pixel, or did I just not notice it before for some baffling reason?

It was already so before the patch.

I just noticed it yesterday too, while looking at this. It extends to both sides when there's no scrollbar.


Maybe Kirigami.Header not knowing about Kirigami.Overlay's shadow?

ngraham accepted this revision.May 5 2020, 10:53 PM
ngraham added a subscriber: ahiemstra.

Yeah, could be. @ahiemstra

This revision is now accepted and ready to land.May 5 2020, 10:53 PM

It looks like OverlaySheet does not account for the 1px border. I'm guessing it works for the other delegates because they are transparent, the section header actually has a background colour set so the border doesn't show up.

If there's no objection, I'll be pushing this this evening (CET), since it fixes an existing layout bug, and the Header issue seems to be separate from this.
Thanks!

This revision was automatically updated to reflect the committed changes.