D28116: Fix sizing of ComboBox and RadioButton
Kai Uwe Broulik
noreply at phabricator.kde.org
Wed Mar 18 08:11:22 GMT 2020
broulik created this revision.
broulik added a reviewer: Plasma.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
broulik requested review of this revision.
REVISION SUMMARY
`KQuickStyleItem` manages its implicit size internally. Overriding it on the QML side makes this non-deterministic which assignment wins and might cause unexpected re-evaluation of the size causing it to change.
Moreover, the check indicator size already includes spacing between checkbox and label on the `QStyle` side, so our additional `spacing` would be added ontop. Furthermore, `CheckBox` `padding` appears to add padding around the control as a whole /and/ between checkbox and label, further widening the gap between the two.
Finally, because of the right padding of the `CheckIndicator`, assigning its `height` to its `width` makes it a lot taller than it should be, resulting in large gaps between controls in e.g. a `FormLayout`.
BUG: 418447
TEST PLAN
The only downside might be that using a `CheckIndicator` standalone now has a quite small size (just the checkbox you see basically) rather than a "nice delegate like height". But then I don't think this control is being used anywhere, and is probably centered vertically anway. When used in conjunction with `ItemDelegate` (checkable item delegate) I believe the entire delegate becomes clickable to toggle the `CheckBox` so it getting smaller should have no effect.
Before:
F8182462: Screenshot_20200318_090022.png <https://phabricator.kde.org/F8182462>
After:
F8182463: Screenshot_20200318_090005.png <https://phabricator.kde.org/F8182463>
The gap is still ever so slightly wider than in a `QCheckBox` but that appears to be the style taking into account the "empty label" which still might have some font lead in/out.
Edit: Just as I was uploading this, I realized that the spacing is now non-existant with styles other than Breeze ... so I'll have to do some more research on how it gets the sizing :(
REPOSITORY
R858 Qt Quick Controls 2: Desktop Style
REVISION DETAIL
https://phabricator.kde.org/D28116
AFFECTED FILES
org.kde.desktop/CheckBox.qml
org.kde.desktop/CheckIndicator.qml
org.kde.desktop/RadioButton.qml
To: broulik, #plasma
Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200318/a6ca1432/attachment-0001.html>
More information about the Plasma-devel
mailing list