This commit is contained in:
朱子楚\zhuzi 2024-05-07 22:16:42 +08:00
parent b916221d9f
commit 655eff4f62
3 changed files with 9 additions and 17 deletions

View File

@ -164,7 +164,7 @@ FluScrollablePage{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
} }
currentIndex: 1 currentIndex: -1
FluCheckBox{ FluCheckBox{
disabled: radio_button_switch4.checked disabled: radio_button_switch4.checked
text: qsTr("Radio Button_1") text: qsTr("Radio Button_1")

View File

@ -18,9 +18,11 @@ Item{
for(var i = 0;i<buttons.length;i++){ for(var i = 0;i<buttons.length;i++){
buttons[i].checked = false buttons[i].checked = false
} }
if(currentIndex>=0 && currentIndex<buttons.length){
buttons[currentIndex].checked = true buttons[currentIndex].checked = true
} }
} }
}
implicitWidth: childrenRect.width implicitWidth: childrenRect.width
implicitHeight: childrenRect.height implicitHeight: childrenRect.height
onCurrentIndexChanged: { onCurrentIndexChanged: {
@ -42,9 +44,6 @@ Item{
} }
} }
} }
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked() d.updateChecked()
} }
} }
@ -52,7 +51,7 @@ Item{
Component{ Component{
id:com_horizontal id:com_horizontal
RowLayout { RowLayout {
data: buttons data: control.buttons
spacing: control.spacing spacing: control.spacing
Component.onCompleted: { Component.onCompleted: {
for(var i = 0;i<control.buttons.length;i++){ for(var i = 0;i<control.buttons.length;i++){
@ -65,9 +64,6 @@ Item{
} }
} }
} }
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked() d.updateChecked()
} }
} }

View File

@ -19,9 +19,11 @@ Item{
for(var i = 0;i<buttons.length;i++){ for(var i = 0;i<buttons.length;i++){
buttons[i].checked = false buttons[i].checked = false
} }
if(currentIndex>=0 && currentIndex<buttons.length){
buttons[currentIndex].checked = true buttons[currentIndex].checked = true
} }
} }
}
implicitWidth: childrenRect.width implicitWidth: childrenRect.width
implicitHeight: childrenRect.height implicitHeight: childrenRect.height
onCurrentIndexChanged: { onCurrentIndexChanged: {
@ -43,9 +45,6 @@ Item{
} }
} }
} }
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked() d.updateChecked()
} }
} }
@ -53,7 +52,7 @@ Item{
Component{ Component{
id:com_horizontal id:com_horizontal
RowLayout { RowLayout {
data: buttons data: control.buttons
spacing: control.spacing spacing: control.spacing
Component.onCompleted: { Component.onCompleted: {
for(var i = 0;i<control.buttons.length;i++){ for(var i = 0;i<control.buttons.length;i++){
@ -66,9 +65,6 @@ Item{
} }
} }
} }
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked() d.updateChecked()
} }
} }