import QtQuick import Weave.Controls import Weave.Templates as T T.RadioButton { id: root implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding, implicitIndicatorWidth) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding, implicitIndicatorHeight) spacing: Theme.component.label.positionSide.paddingLeft padding: 0 font.family: Theme.component.label.fontFamily font.pixelSize: Theme.component.label.positionSide.fontSize font.weight: Theme.component.label.fontWeight hoverEnabled: root.enabled radioButtonAlignment: mirrored ? RadioButton.AlignRight : RadioButton.AlignLeft indicator: Item { implicitWidth: Theme.component.radiobutton.container.width implicitHeight: Theme.component.radiobutton.container.height x: root.text ? (root.radioButtonAlignment === RadioButton.AlignRight ? root.width - width - root.rightPadding : root.leftPadding) : root.leftPadding + (root.availableWidth - width) / 2 y: root.topPadding + (root.availableHeight - height) / 2 Rectangle { anchors.centerIn: parent implicitWidth: Theme.component.radiobutton.width implicitHeight: Theme.component.radiobutton.height opacity: root.enabled ? 1.0 : Theme.component.radiobutton.opacity.disabled color: (root.enabled && root.hovered) ? "transparent" : root.checked ? Theme.component.radiobutton.backgroundColor : "transparent" border.width: root.checked ? Theme.component.radiobutton.borderWidth.selected : Theme.component.radiobutton.borderWidth.default border.color: root.checked ? Theme.component.radiobutton.borderColor.selected : (root.pressed || root.hovered) ? Theme.component.radiobutton.borderColor.default : root.visualFocus ? Theme.component.radiobutton.borderColor.focus : Theme.component.radiobutton.borderColor.default radius: width/2 // Theme.component.radiobutton.borderRadius // TODO: token is invalid, "50%" should be a pixel value instead BoxShadow { width: parent.width height: parent.height radius: width / 2 z: -1 readonly property string shadowState: root.pressed ? "pressed" : root.enabled && root.hovered ? "hover" : root.visualFocus ? "focus" : "hover" offsetX: Theme.component.radiobutton.boxShadowX[shadowState] offsetY: Theme.component.radiobutton.boxShadowY[shadowState] blurRadius: Theme.component.radiobutton.boxShadowBlur[shadowState] spreadRadius: Theme.component.radiobutton.boxShadowSpread[shadowState] color: shadowState === "hover" && (!root.enabled || !root.hovered) ? "transparent" : Theme.component.radiobutton.boxShadowColor[shadowState] } } } contentItem: Text { leftPadding: root.indicator && root.radioButtonAlignment === RadioButton.AlignLeft ? root.indicator.width - ((Theme.component.radiobutton.container.width - Theme.component.radiobutton.width)/2) + (text ? root.spacing : 0) : ((Theme.component.radiobutton.container.width - Theme.component.radiobutton.width)/2) rightPadding: root.indicator && root.radioButtonAlignment === RadioButton.AlignRight ? root.indicator.width - ((Theme.component.radiobutton.container.width - Theme.component.radiobutton.width)/2) + (text ? root.spacing : 0) : ((Theme.component.radiobutton.container.width - Theme.component.radiobutton.width)/2) text: root.text color: Theme.component.label.textColor font: root.font lineHeight: Theme.component.label.positionSide.lineHeight lineHeightMode: Text.FixedHeight verticalAlignment: Text.AlignVCenter opacity: root.enabled ? 1.0 : Theme.component.radiobutton.opacity.disabled } }