Fluid 1.3.0
Material Design for QtQuick and Qml
Loading...
Searching...
No Matches
RadioIndicator.qml
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// SPDX-License-Identifier: MPL-2.0
3
4import QtQuick
5import Fluid as MD
6
20Item {
21 id: indicatorItem
22 Accessible.ignored: true
23
25 property Item control
26
28 property color color
29
30 implicitWidth: MD.Tokens.radioButton.iconSize
31 + MD.Tokens.radioButton.indicatorPadding * 2
32 implicitHeight: MD.Tokens.radioButton.iconSize
33 + MD.Tokens.radioButton.indicatorPadding * 2
34
35 Rectangle {
36 id: outerRing
37
38 objectName: "radioOuterRing"
39 anchors.centerIn: parent
40 width: MD.Tokens.radioButton.iconSize
41 height: width
42 radius: width / 2
43 color: "transparent"
44 border.width: MD.Tokens.radioButton.outlineWidth
45 border.color: indicatorItem.color
46
47 Behavior on border.color {
48 // Disabled color changes must snap rather than animate.
49 // qmllint disable missing-property
50 enabled: indicatorItem.control && indicatorItem.control.enabled
51 // qmllint enable missing-property
52
53 ColorAnimation {
54 // qmllint disable unresolved-type
55 duration: MD.Tokens.motion.duration.short2
56 // qmllint enable unresolved-type
57 }
58 }
59
60 Rectangle {
61 id: selectedDot
62
63 objectName: "radioSelectedDot"
64 anchors.centerIn: parent
65 // qmllint disable missing-property
66 width: indicatorItem.control && indicatorItem.control.checked
67 ? MD.Tokens.radioButton.iconSize / 2 : 0
68 // qmllint enable missing-property
69 height: width
70 radius: width / 2
71 color: indicatorItem.color
72
73 Behavior on width {
74 NumberAnimation {
75 // qmllint disable unresolved-type
76 duration: MD.Tokens.motion.duration.short2
77 // qmllint enable unresolved-type
78 }
79 }
80
81 Behavior on color {
82 // Disabled color changes must snap rather than animate.
83 // qmllint disable missing-property
84 enabled: indicatorItem.control && indicatorItem.control.enabled
85 // qmllint enable missing-property
86
87 ColorAnimation {
88 // qmllint disable unresolved-type
89 duration: MD.Tokens.motion.duration.short2
90 // qmllint enable unresolved-type
91 }
92 }
93 }
94 }
95}