diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 5e6b05f1..05473f57 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -1273,19 +1273,19 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - + E-mail - + Calendar - + Contacts @@ -1295,6 +1295,11 @@ My only desire is to be permitted to drive out the traitors and restore the Han. RadioButton Group111111111111111111111111 + + + Disabled + + T_Home @@ -1358,46 +1363,77 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - + Info - - + + This is an InfoBar in the Info Style - + Warning - + This is an InfoBar in the Warning Style - + This is an InfoBar in the Error Style - + This is an InfoBar in the Success Style - + InfoBar that needs to be turned off manually - + Manual shutdown is supported + + + Manually close the info message box + + + + + + + close '%1' + + + + + + + show '%1 + + + + + + + This is an '%1' + + + + + clear all info + + T_LineChart @@ -1700,30 +1736,30 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - - - + + + Disabled - - + + Radio Button_1 - - - + + + Radio Button_2 - - - + + + Radio Button_3 diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 9699fa8f..a3a1fc05 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -1359,19 +1359,19 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - + E-mail 邮箱 - + Calendar 日历 - + Contacts 联系人 @@ -1381,6 +1381,11 @@ My only desire is to be permitted to drive out the traitors and restore the Han. RadioButton Group111111111111111111111111 单选框分组 + + + Disabled + 禁用 + T_Home @@ -1452,46 +1457,77 @@ My only desire is to be permitted to drive out the traitors and restore the Han. 信息栏 - + Info - - + + This is an InfoBar in the Info Style 这是一个Info样式的信息栏 - + Warning - + This is an InfoBar in the Warning Style 这是一个Warning样式的信息栏 - + This is an InfoBar in the Error Style 这是一个Error样式的信息栏 - + This is an InfoBar in the Success Style 这是一个Success样式的信息栏 - + InfoBar that needs to be turned off manually 需要手动关闭的信息栏 - + Manual shutdown is supported 支持手动关闭 + + + Manually close the info message box + + + + + + + close '%1' + + + + + + + show '%1 + + + + + + + This is an '%1' + + + + + clear all info + + Loading... 加载中... @@ -1808,30 +1844,30 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - - - + + + Disabled 禁用 - - + + Radio Button_1 - - - + + + Radio Button_2 - - - + + + Radio Button_3 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/example/qml/page/T_InfoBar.qml b/example/qml/page/T_InfoBar.qml index 52862494..7e68055b 100644 --- a/example/qml/page/T_InfoBar.qml +++ b/example/qml/page/T_InfoBar.qml @@ -9,9 +9,13 @@ FluScrollablePage{ title: qsTr("InfoBar") + property var info1 + property var info2 + property var info3 + FluFrame{ Layout.fillWidth: true - Layout.preferredHeight: 270 + Layout.preferredHeight: 350 padding: 10 ColumnLayout{ spacing: 14 @@ -49,6 +53,51 @@ FluScrollablePage{ showInfo(qsTr("This is an InfoBar in the Info Style"),0,qsTr("Manual shutdown is supported")) } } + FluText{ + wrapMode: Text.WrapAnywhere + width: parent.width + text: qsTr("Manually close the info message box") + } + Row{ + spacing: 5 + FluButton{ + text: (info1 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info1") + onClicked: { + if(info1) { + info1.close() + return + } + info1 = showInfo(qsTr("This is an '%1'").arg("info1"), 0) + } + } + FluButton{ + text: (info2 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info2") + onClicked: { + if(info2) { + info2.close() + return + } + info2 = showInfo(qsTr("This is an '%1'").arg("info2"), 0) + } + } + FluButton{ + text: (info3 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info3") + onClicked: { + if(info3) { + info3.close() + return + } + info3 = showInfo(qsTr("This is an '%1'").arg("info3"), 0) + } + } + FluButton{ + text: qsTr("clear all info") + onClicked: { + clearAllInfo() + } + } + } + FluButton{ text:"Loading" onClicked: { @@ -60,12 +109,17 @@ FluScrollablePage{ CodeExpander{ Layout.fillWidth: true Layout.topMargin: -6 - code:'showInfo(qsTr("This is an InfoBar in the Info Style")) + code:` +showInfo(qsTr("This is an InfoBar in the Info Style")) showWarning(qsTr("This is an InfoBar in the Warning Style")) showError(qsTr("This is an InfoBar in the Error Style")) -showSuccess(qsTr("This is an InfoBar in the Success Style"))' +showSuccess(qsTr("This is an InfoBar in the Success Style")) + +var info1 = showInfo(qsTr("This is an 'Info1'"), 0) +info1.close() +` } } diff --git a/example/qml/page/T_RadioButton.qml b/example/qml/page/T_RadioButton.qml index 0dce688d..a8ab4dcb 100644 --- a/example/qml/page/T_RadioButton.qml +++ b/example/qml/page/T_RadioButton.qml @@ -53,6 +53,7 @@ FluScrollablePage{ Layout.topMargin: 20 FluRadioButtons{ spacing: 8 + disabled: radio_button_switch2.checked anchors.verticalCenter: parent.verticalCenter anchors{ verticalCenter: parent.verticalCenter @@ -60,15 +61,12 @@ FluScrollablePage{ } currentIndex: 1 FluRadioButton{ - disabled: radio_button_switch2.checked text: qsTr("Radio Button_1") } FluRadioButton{ - disabled: radio_button_switch2.checked text: qsTr("Radio Button_2") } FluRadioButton{ - disabled: radio_button_switch2.checked text: qsTr("Radio Button_3") } } @@ -110,18 +108,16 @@ FluScrollablePage{ verticalCenter: parent.verticalCenter left: parent.left } + disabled: radio_button_switch3.checked orientation: Qt.Horizontal currentIndex: 1 FluRadioButton{ - disabled: radio_button_switch3.checked text: qsTr("Radio Button_1") } FluRadioButton{ - disabled: radio_button_switch3.checked text: qsTr("Radio Button_2") } FluRadioButton{ - disabled: radio_button_switch3.checked text: qsTr("Radio Button_3") } } @@ -164,17 +160,15 @@ FluScrollablePage{ verticalCenter: parent.verticalCenter left: parent.left } + disabled: radio_button_switch4.checked currentIndex: -1 FluCheckBox{ - disabled: radio_button_switch4.checked text: qsTr("Radio Button_1") } FluCheckBox{ - disabled: radio_button_switch4.checked text: qsTr("Radio Button_2") } FluCheckBox{ - disabled: radio_button_switch4.checked text: qsTr("Radio Button_3") } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml b/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml index 3773a1e2..ecaaa37d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluInfoBar.qml @@ -18,22 +18,23 @@ FluObject { if(screenLayout){ var last = screenLayout.getLastloader(); if(last.type === type && last.text === text && moremsg === last.moremsg){ - last.restart(); - return; + last.duration = duration + if (duration > 0) last.restart(); + return last; } } initScreenLayout(); - contentComponent.createObject(screenLayout,{ - type:type, - text:text, - duration:duration, - moremsg:moremsg, - }); + return contentComponent.createObject(screenLayout,{ + type:type, + text:text, + duration:duration, + moremsg:moremsg, + }); } function createCustom(itemcomponent,duration){ initScreenLayout(); if(itemcomponent){ - contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration}); + return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration}); } } function initScreenLayout(){ @@ -85,7 +86,9 @@ FluObject { } Timer { id:delayTimer - interval: duration; running: duration > 0; repeat: duration > 0 + interval: duration; + running: duration > 0; + repeat: duration > 0 onTriggered: content.close(); } FluLoader{ @@ -235,18 +238,26 @@ FluObject { } } function showSuccess(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : ""); } function showInfo(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : ""); } function showWarning(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : ""); } function showError(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : ""); } function showCustom(itemcomponent,duration=1000){ - mcontrol.createCustom(itemcomponent,duration); + return mcontrol.createCustom(itemcomponent,duration); + } + function clearAllInfo(){ + if(mcontrol.screenLayout != null) { + mcontrol.screenLayout.destroy() + mcontrol.screenLayout = null + } + + return true } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml b/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml index 8229930d..24c55a65 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml @@ -9,6 +9,8 @@ Item{ property int currentIndex : -1 property int spacing: 8 property int orientation: Qt.Vertical + property bool disabled: false + property bool manuallyDisabled: false QtObject{ id: d function updateChecked(){ @@ -22,12 +24,23 @@ Item{ buttons[currentIndex].checked = true } } + function refreshButtonStatus() { + for(var i = 0;i 0) last.restart(); + return last; } } initScreenLayout(); - contentComponent.createObject(screenLayout,{ - type:type, - text:text, - duration:duration, - moremsg:moremsg, - }); + return contentComponent.createObject(screenLayout,{ + type:type, + text:text, + duration:duration, + moremsg:moremsg, + }); } function createCustom(itemcomponent,duration){ initScreenLayout(); if(itemcomponent){ - contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration}); + return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration}); } } function initScreenLayout(){ @@ -85,7 +86,9 @@ FluObject { } Timer { id:delayTimer - interval: duration; running: duration > 0; repeat: duration > 0 + interval: duration; + running: duration > 0; + repeat: duration > 0 onTriggered: content.close(); } FluLoader{ @@ -235,18 +238,26 @@ FluObject { } } function showSuccess(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : ""); } function showInfo(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : ""); } function showWarning(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : ""); } function showError(text,duration=1000,moremsg){ - mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : ""); + return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : ""); } function showCustom(itemcomponent,duration=1000){ - mcontrol.createCustom(itemcomponent,duration); + return mcontrol.createCustom(itemcomponent,duration); + } + function clearAllInfo(){ + if(mcontrol.screenLayout != null) { + mcontrol.screenLayout.destroy() + mcontrol.screenLayout = null + } + + return true } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml b/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml index 3d79aa35..7bb82e69 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml @@ -10,6 +10,8 @@ Item{ property int currentIndex : -1 property int spacing: 8 property int orientation: Qt.Vertical + property bool disabled: false + property bool manuallyDisabled: false QtObject{ id: d function updateChecked(){ @@ -23,12 +25,23 @@ Item{ buttons[currentIndex].checked = true } } + function refreshButtonStatus() { + for(var i = 0;i