QtShadcn
组件

ShadcnRadio / ShadcnRadioGroup

单选组:16px 正圆,选中 primary + 内圆点,同组互斥。

单选按钮组:16px 正圆,选中 primary 底 + primaryForeground 内圆点;同组互斥、方向键切换。

用法

ShadcnRadioGroup {
    ShadcnRadio { text: qsTr("默认主题"); checked: true }
    ShadcnRadio { text: qsTr("蓝色主题") }
    ShadcnRadio { text: qsTr("绿色主题") }
}

属性

组件属性说明
ShadcnRadioGroupbuttons / checkedButton暴露 QQC ButtonGroup(查询选中项)
ShadcnRadiotext / checked / enabled选项文本 / 选中 / 禁用

说明

  • 基于 QQC.RadioButton + ButtonGroup(exclusive),键盘方向键 / 上下切换
  • 16px 正圆 + border + bg-input/90;选中 primary 底 + 8px primaryForeground 内圆点
  • 聚焦 border-ring + 3px 外环
  • 组内互斥由 onCompleted 手动收集子项到 ButtonGroup
Copyright © 2026