修复部分控件在禁用后错误高亮的问题

涉及控件如下:FluCheckBox、FluCopyableText、FluIcon、FluIconButton、FluRadioButton、FluText、FluToggleSwitch
This commit is contained in:
lucky9loogn
2024-11-25 14:59:18 +08:00
parent d75ecfeca7
commit 2a639022ec
19 changed files with 215 additions and 27 deletions

View File

@ -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
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}
}
}

View File

@ -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
}

View File

@ -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
}
}
}

View File

@ -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
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}
}
}

View File

@ -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
}

View File

@ -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
}
}
}