mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-23 04:14:35 +08:00
Compare commits
1 Commits
6c6bcbcda1
...
74f265dd41
Author | SHA1 | Date | |
---|---|---|---|
|
74f265dd41 |
@ -22,37 +22,18 @@ 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
|
||||
@ -61,20 +42,7 @@ FluGroupBox {
|
||||
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") }
|
||||
}
|
||||
}
|
||||
`
|
||||
}'
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ 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<buttons.length;i++){
|
||||
@ -18,12 +16,6 @@ ColumnLayout {
|
||||
button.checked = true
|
||||
}
|
||||
}
|
||||
onDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
onManuallyDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
buttons[i].clickListener = function(){
|
||||
@ -35,12 +27,6 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshButtonStatus()
|
||||
}
|
||||
|
||||
function refreshButtonStatus() {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
if(!manuallyDisabled) buttons[i].enabled = !disabled
|
||||
}
|
||||
currentIndex = 0
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ import FluentUI
|
||||
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<buttons.length;i++){
|
||||
@ -19,12 +17,6 @@ ColumnLayout {
|
||||
button.checked = true
|
||||
}
|
||||
}
|
||||
onDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
onManuallyDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
buttons[i].clickListener = function(){
|
||||
@ -36,12 +28,6 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshButtonStatus()
|
||||
}
|
||||
|
||||
function refreshButtonStatus() {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
if(!manuallyDisabled) buttons[i].enabled = !disabled
|
||||
}
|
||||
currentIndex = 0
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user