From 9aa6615189ed896ee4f20447a6a0f86e6917b7d1 Mon Sep 17 00:00:00 2001 From: gaoxiangyang Date: Wed, 8 May 2024 21:10:00 +0800 Subject: [PATCH] =?UTF-8?q?FluRadioButtons=20=E7=BB=84=E4=BB=B6=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20disabled=E3=80=81manuallyDisabled=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit disabled: true // 禁用所有FluRadioButton子组件 manuallyDisabled: true // 是否指定每个FluRadioButton上的disabled选项 --- example/qml/page/T_GroupBox.qml | 36 +++++++++++++++++-- .../FluentUI/Controls/FluRadioButtons.qml | 16 ++++++++- .../FluentUI/Controls/FluRadioButtons.qml | 16 ++++++++- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/example/qml/page/T_GroupBox.qml b/example/qml/page/T_GroupBox.qml index 7a9c698b..4da717c6 100644 --- a/example/qml/page/T_GroupBox.qml +++ b/example/qml/page/T_GroupBox.qml @@ -22,18 +22,37 @@ FluScrollablePage{ FluGroupBox { title: qsTr("RadioButton Group") + Layout.fillWidth: true + Layout.preferredHeight: 150 + Layout.topMargin: 20 FluRadioButtons { + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + } spacing: 10 + disabled: radio_button_switch.checked FluRadioButton { text: qsTr("E-mail") } FluRadioButton { text: qsTr("Calendar") } FluRadioButton { text: qsTr("Contacts") } } + + FluToggleSwitch{ + id: radio_button_switch + anchors{ + right: parent.right + verticalCenter: parent.verticalCenter + } + text: qsTr("Disabled") + } } + CodeExpander{ Layout.fillWidth: true Layout.topMargin: 4 - code:'FluGroupBox { + code:` +FluGroupBox { title: qsTr("CheckBox Group") ColumnLayout { spacing: 10 @@ -42,7 +61,20 @@ FluScrollablePage{ FluCheckBox { text: qsTr("Calendar") } FluCheckBox { text: qsTr("Contacts") } } -}' +} + +FluGroupBox { + title: qsTr("RadioButton Group") + FluRadioButtons { + spacing: 10 + disabled: true // 禁用所有FluRadioButton子组件 + manuallyDisabled: true // 是否指定每个FluRadioButton上的disabled选项 + FluRadioButton { text: qsTr("E-mail") } + FluRadioButton { text: qsTr("Calendar") } + FluRadioButton { text: qsTr("Contacts") } + } +} +` } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml b/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml index 83060795..b725950a 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml @@ -6,6 +6,8 @@ import FluentUI 1.0 ColumnLayout { default property alias buttons: control.data property int currentIndex : -1 + property bool disabled: false + property bool manuallyDisabled: false id:control onCurrentIndexChanged: { for(var i = 0;i