Fix sizing of CheckBox and RadioButton

Authored by broulik on Mar 18 2020, 9:08 AM.

Description

Fix sizing of CheckBox and RadioButton

KQuickStyleItem manages its implicit size internally. Overriding it on the QML side makes it non-deterministic
which assignment wins and might cause unexpected re-evaluation of the size causing it to change.

Moreover, the CheckIndicator implicit size is based on sizeFromContents for CT_CheckBox, which in case of Breeze
(but not the Qt built-in styles) already contains some extra padding on the side between checkbox and label.
Instead of using that for layouting our full checkbox (indicator + label), do what qqc1 did and use
PM_CheckBoxLabelSpacing for spacing and PM_IndicatorWidth as size hint for the indicator.

Also while at it for radio buttons use the appropriate (PM_RadioButtonLabelSpacing and PM_ExclusiveIndicatorWidth) hints.

This makes QQC2 CheckBox and RadioButton layouted pixel-perfect to their QWidget counterparts and also fixes
it randomly changing size hints as you switch between pages as demonstrated by the bug report.

BUG: 418447

Differential Revision: https://phabricator.kde.org/D28116

Details

Committed
broulikMar 18 2020, 9:09 AM
Differential Revision
D28116: Fix sizing of ComboBox and RadioButton
Parents
R858:1bb57b10e7bd: Use `ShadowedRectangle`
Branches
Unknown
Tags
Unknown