Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.5.0
-
-
872672288 (dev), fa184d038 (6.7), 18159e199 (6.6), 9707caa0e (tqtc/lts-6.5)
Description
RadioButton don't have any animation when changing state in the Material style, unlike CheckButton. It should grow when checked and shrink when unchecked. Now that support for Material 3 was added this is the perfect time to fix this.
I fixed that on my projects by modifying the inner Rectangle of the RadioIndicator source code:
// Original source for Material's RadioIndicator from Qt 6.5.0
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 10
height: 10
radius: width / 2
color: parent.border.color
visible: indicator.control.checked || indicator.control.down
}
I only changed three lines:
// My source Rectangle { x: (parent.width - width) / 2 y: (parent.height - height) / 2 width: indicator.control.checked ? 10 : 0 // modified, replaces "visible" height: width // modified radius: width / 2 color: parent.border.color Behavior on width { NumberAnimation { easing.type: Easing.OutBack } } // added }
I know you guys don't like to use Behavior in sources but this is the easier way for me and it works. There's an example of one of my projects bellow. Hope this helps!