diff --git a/example/example_en_US.ts b/example/example_en_US.ts index e22c8eda..6381b570 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -902,7 +902,7 @@ Updated content: - + Disabled @@ -1022,12 +1022,12 @@ Updated content: - + Radio Button_2 - + Radio Button_3 @@ -1421,7 +1421,12 @@ My only desire is to be permitted to drive out the traitors and restore the Han. - + + Disabled + + + + You Copied @@ -2185,10 +2190,15 @@ Some contents... - + This is a text that can be copied + + + Disabled + + T_TextBox diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 71fd7ad2..0cfe1119 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -929,7 +929,7 @@ Updated content: - + Disabled 禁用 @@ -1049,12 +1049,12 @@ Updated content: - + Radio Button_2 - + Radio Button_3 @@ -1538,12 +1538,17 @@ My only desire is to be permitted to drive out the traitors and restore the Han. Please enter a keyword 请输入关键字 + + + Disabled + 禁用 + Search 搜索 - + You Copied 您复制 @@ -2367,10 +2372,15 @@ Some contents... 文本 - + This is a text that can be copied 这是一个可以复制的文本 + + + Disabled + 禁用 + T_TextBox diff --git a/example/qml/page/T_Buttons.qml b/example/qml/page/T_Buttons.qml index eee6ee32..e2aa4239 100644 --- a/example/qml/page/T_Buttons.qml +++ b/example/qml/page/T_Buttons.qml @@ -399,16 +399,14 @@ FluScrollablePage{ verticalCenter: parent.verticalCenter left: parent.left } + disabled: radio_button_switch.checked FluRadioButton{ - disabled:radio_button_switch.checked text: qsTr("Radio Button_1") } FluRadioButton{ - disabled:radio_button_switch.checked text: qsTr("Radio Button_2") } FluRadioButton{ - disabled:radio_button_switch.checked text: qsTr("Radio Button_3") } } diff --git a/example/qml/page/T_Icons.qml b/example/qml/page/T_Icons.qml index cb078ce5..b22fd462 100644 --- a/example/qml/page/T_Icons.qml +++ b/example/qml/page/T_Icons.qml @@ -18,6 +18,15 @@ FluContentPage { grid_view.model = FluApp.iconData(text_box.text) } } + FluToggleSwitch{ + id: toggle_switch + anchors{ + left: text_box.right + verticalCenter: text_box.verticalCenter + leftMargin: 10 + } + text: qsTr("Disabled") + } GridView{ id: grid_view cellWidth: 110 @@ -45,6 +54,7 @@ FluContentPage { horizontalPadding: 0 bottomPadding: 30 anchors.fill: parent + disabled: toggle_switch.checked onClicked: { var text ="FluentIcons."+modelData.name; FluTools.clipText(text) @@ -57,6 +67,7 @@ FluContentPage { text: modelData.name anchors.top: parent.top anchors.topMargin: 60 + enabled: !toggle_switch.checked } } } diff --git a/example/qml/page/T_Text.qml b/example/qml/page/T_Text.qml index f8e819a1..75bba771 100644 --- a/example/qml/page/T_Text.qml +++ b/example/qml/page/T_Text.qml @@ -15,10 +15,19 @@ FluScrollablePage{ padding: 10 FluCopyableText{ + enabled: !toggle_switch.checked text: qsTr("This is a text that can be copied") anchors.verticalCenter: parent.verticalCenter } + FluToggleSwitch{ + id: toggle_switch + anchors{ + right: parent.right + verticalCenter: parent.verticalCenter + } + text: qsTr("Disabled") + } } CodeExpander{ Layout.fillWidth: true diff --git a/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml b/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml index 37c2107e..c02cfc14 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml @@ -19,7 +19,19 @@ Button { property color checkedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1) property real size: 18 - property alias textColor: btn_text.textColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } property bool textRight: true property real textSpacing: 6 property bool animationEnabled: FluTheme.animationEnabled @@ -127,6 +139,7 @@ Button { Layout.alignment: Qt.AlignVCenter visible: text !== "" font: control.font + color: control.textColor } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluCopyableText.qml b/src/Qt5/imports/FluentUI/Controls/FluCopyableText.qml index 6d0866c5..d9de27a1 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluCopyableText.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluCopyableText.qml @@ -3,7 +3,19 @@ import QtQuick.Controls 2.15 import FluentUI 1.0 TextEdit { - property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220 + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } id:control color: textColor readOnly: true diff --git a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml index 7b1f6098..2435c87e 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluIcon.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluIcon.qml @@ -5,7 +5,19 @@ import FluentUI 1.0 Text { property int iconSource property int iconSize: 20 - property color iconColor: FluTheme.dark ? "#FFFFFF" : "#000000" + property color iconColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } id:control font.family: font_loader.name font.pixelSize: iconSize diff --git a/src/Qt5/imports/FluentUI/Controls/FluIconButton.qml b/src/Qt5/imports/FluentUI/Controls/FluIconButton.qml index f76e3c82..d2979c0d 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluIconButton.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluIconButton.qml @@ -37,7 +37,19 @@ Button { return Qt.rgba(0,0,0,1) } } - property color textColor: FluTheme.fontPrimaryColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } Accessible.role: Accessible.Button Accessible.name: control.text Accessible.description: contentDescription diff --git a/src/Qt5/imports/FluentUI/Controls/FluPivot.qml b/src/Qt5/imports/FluentUI/Controls/FluPivot.qml index 866af6b6..ce45429a 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluPivot.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluPivot.qml @@ -5,8 +5,9 @@ import FluentUI 1.0 Page { default property alias content: d.children property alias currentIndex: nav_list.currentIndex + property color textHighlightColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 - property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black + property color textHoverColor: FluTheme.dark ? FluColors.Grey80 : FluColors.Grey150 property int textSpacing: 10 property int headerSpacing: 20 property int headerHeight: 40 @@ -66,9 +67,13 @@ Page { anchors.centerIn: parent font: control.font color: { - if(item_button.hovered) - return textHoverColor - return textNormalColor + if(nav_list.currentIndex === index) { + return textHighlightColor; + } + if (item_button.hovered) { + return textHoverColor; + } + return textNormalColor; } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluRadioButton.qml b/src/Qt5/imports/FluentUI/Controls/FluRadioButton.qml index efd372f1..61052967 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluRadioButton.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluRadioButton.qml @@ -11,7 +11,19 @@ Button { property color normalColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1) property color hoverColor: checked ? FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1) property color disableColor: checked ? FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(159/255,159/255,159/255,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1) - property alias textColor: btn_text.textColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } property real size: 18 property bool textRight: true property real textSpacing: 6 @@ -94,6 +106,7 @@ Button { Layout.alignment: Qt.AlignVCenter visible: text !== "" font: control.font + color: control.textColor } } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluText.qml b/src/Qt5/imports/FluentUI/Controls/FluText.qml index 029c6d2d..86590f49 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluText.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluText.qml @@ -5,7 +5,7 @@ import FluentUI 1.0 Text { property color textColor: FluTheme.fontPrimaryColor id:text - color: textColor + color: enabled ? textColor : (FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)) renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering font: FluTextStyle.Body } diff --git a/src/Qt5/imports/FluentUI/Controls/FluToggleSwitch.qml b/src/Qt5/imports/FluentUI/Controls/FluToggleSwitch.qml index e4f01f57..63efa5ea 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluToggleSwitch.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluToggleSwitch.qml @@ -18,7 +18,19 @@ Button { property color dotDisableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(150/255,150/255,150/255,1) property real textSpacing: 6 property bool textRight: true - property alias textColor: btn_text.textColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } property var clickListener : function(){ checked = !checked } @@ -115,6 +127,7 @@ Button { text: control.text Layout.alignment: Qt.AlignVCenter visible: text !== "" + color: control.textColor } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml b/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml index 2b4292f5..2279b0d8 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml @@ -20,7 +20,19 @@ Button { property color checkedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1) property real size: 18 - property alias textColor: btn_text.textColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } property bool textRight: true property real textSpacing: 6 property bool animationEnabled: FluTheme.animationEnabled @@ -129,6 +141,7 @@ Button { Layout.alignment: Qt.AlignVCenter visible: text !== "" font: control.font + color: control.textColor } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluCopyableText.qml b/src/Qt6/imports/FluentUI/Controls/FluCopyableText.qml index 34d4368c..74618045 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluCopyableText.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluCopyableText.qml @@ -3,7 +3,19 @@ import QtQuick.Controls import FluentUI TextEdit { - property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220 + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } id:control color: textColor readOnly: true diff --git a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml index a8bb3b2a..b7f84d92 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluIcon.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluIcon.qml @@ -5,7 +5,19 @@ import FluentUI Text { property int iconSource property int iconSize: 20 - property color iconColor: FluTheme.dark ? "#FFFFFF" : "#000000" + property color iconColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } id:control font.family: font_loader.name font.pixelSize: iconSize diff --git a/src/Qt6/imports/FluentUI/Controls/FluIconButton.qml b/src/Qt6/imports/FluentUI/Controls/FluIconButton.qml index b52dcff6..4743127d 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluIconButton.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluIconButton.qml @@ -38,7 +38,19 @@ Button { return Qt.rgba(0,0,0,1) } } - property color textColor: FluTheme.fontPrimaryColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } Accessible.role: Accessible.Button Accessible.name: control.text Accessible.description: contentDescription diff --git a/src/Qt6/imports/FluentUI/Controls/FluPivot.qml b/src/Qt6/imports/FluentUI/Controls/FluPivot.qml index 38a19f04..7c0a9681 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluPivot.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluPivot.qml @@ -6,8 +6,9 @@ import FluentUI Page { default property alias content: d.children property alias currentIndex: nav_list.currentIndex + property color textHighlightColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 - property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black + property color textHoverColor: FluTheme.dark ? FluColors.Grey80 : FluColors.Grey150 property int textSpacing: 10 property int headerSpacing: 20 property int headerHeight: 40 @@ -67,9 +68,13 @@ Page { anchors.centerIn: parent font: control.font color: { - if(item_button.hovered) - return textHoverColor - return textNormalColor + if(nav_list.currentIndex === index) { + return textHighlightColor; + } + if (item_button.hovered) { + return textHoverColor; + } + return textNormalColor; } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluRadioButton.qml b/src/Qt6/imports/FluentUI/Controls/FluRadioButton.qml index 449c8e2c..cf66dbe7 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluRadioButton.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluRadioButton.qml @@ -12,7 +12,19 @@ Button { property color normalColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1) property color hoverColor: checked ? FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1) property color disableColor: checked ? FluTheme.dark ? Qt.rgba(159/255,159/255,159/255,1) : Qt.rgba(159/255,159/255,159/255,1) : FluTheme.dark ? Qt.rgba(43/255,43/255,43/255,1) : Qt.rgba(222/255,222/255,222/255,1) - property alias textColor: btn_text.textColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } property real size: 18 property bool textRight: true property real textSpacing: 6 @@ -90,6 +102,7 @@ Button { Layout.alignment: Qt.AlignVCenter font: control.font visible: text !== "" + color: control.textColor } } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluText.qml b/src/Qt6/imports/FluentUI/Controls/FluText.qml index 40c65009..0e3d99ef 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluText.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluText.qml @@ -5,7 +5,7 @@ import FluentUI Text { property color textColor: FluTheme.fontPrimaryColor id:text - color: textColor + color: enabled ? textColor : (FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)) renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering font: FluTextStyle.Body } diff --git a/src/Qt6/imports/FluentUI/Controls/FluToggleSwitch.qml b/src/Qt6/imports/FluentUI/Controls/FluToggleSwitch.qml index 77f17c6f..5ac987b8 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluToggleSwitch.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluToggleSwitch.qml @@ -19,7 +19,19 @@ Button { property color dotDisableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(150/255,150/255,150/255,1) property real textSpacing: 6 property bool textRight: true - property alias textColor: btn_text.textColor + property color textColor: { + if(FluTheme.dark){ + if(!enabled){ + return Qt.rgba(130/255,130/255,130/255,1) + } + return Qt.rgba(1,1,1,1) + }else{ + if(!enabled){ + return Qt.rgba(161/255,161/255,161/255,1) + } + return Qt.rgba(0,0,0,1) + } + } property var clickListener : function(){ checked = !checked } @@ -116,6 +128,7 @@ Button { text: control.text Layout.alignment: Qt.AlignVCenter visible: text !== "" + color: control.textColor } } }