Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed May 7, 2024
1 parent b916221 commit 655eff4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion example/qml/page/T_RadioButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ FluScrollablePage{
verticalCenter: parent.verticalCenter
left: parent.left
}
currentIndex: 1
currentIndex: -1
FluCheckBox{
disabled: radio_button_switch4.checked
text: qsTr("Radio Button_1")
Expand Down
12 changes: 4 additions & 8 deletions src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Item{
for(var i = 0;i<buttons.length;i++){
buttons[i].checked = false
}
buttons[currentIndex].checked = true
if(currentIndex>=0 && currentIndex<buttons.length){
buttons[currentIndex].checked = true
}
}
}
implicitWidth: childrenRect.width
Expand All @@ -42,17 +44,14 @@ Item{
}
}
}
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked()
}
}
}
Component{
id:com_horizontal
RowLayout {
data: buttons
data: control.buttons
spacing: control.spacing
Component.onCompleted: {
for(var i = 0;i<control.buttons.length;i++){
Expand All @@ -65,9 +64,6 @@ Item{
}
}
}
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked()
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Item{
for(var i = 0;i<buttons.length;i++){
buttons[i].checked = false
}
buttons[currentIndex].checked = true
if(currentIndex>=0 && currentIndex<buttons.length){
buttons[currentIndex].checked = true
}
}
}
implicitWidth: childrenRect.width
Expand All @@ -43,17 +45,14 @@ Item{
}
}
}
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked()
}
}
}
Component{
id:com_horizontal
RowLayout {
data: buttons
data: control.buttons
spacing: control.spacing
Component.onCompleted: {
for(var i = 0;i<control.buttons.length;i++){
Expand All @@ -66,9 +65,6 @@ Item{
}
}
}
if(control.currentIndex < 0){
control.currentIndex = 0
}
d.updateChecked()
}
}
Expand Down

0 comments on commit 655eff4

Please sign in to comment.