Merge pull request #575 from lucky9loogn/fix-highlight

修复部分控件的错误高亮问题
This commit is contained in:
zhuzichu 2024-11-26 10:40:34 +08:00 committed by GitHub
commit d13c5a9c2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 233 additions and 35 deletions

View File

@ -902,7 +902,7 @@ Updated content:
<location filename="qml/page/T_Buttons.qml" line="199"/>
<location filename="qml/page/T_Buttons.qml" line="320"/>
<location filename="qml/page/T_Buttons.qml" line="368"/>
<location filename="qml/page/T_Buttons.qml" line="421"/>
<location filename="qml/page/T_Buttons.qml" line="419"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
@ -1022,12 +1022,12 @@ Updated content:
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Buttons.qml" line="408"/>
<location filename="qml/page/T_Buttons.qml" line="407"/>
<source>Radio Button_2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Buttons.qml" line="412"/>
<location filename="qml/page/T_Buttons.qml" line="410"/>
<source>Radio Button_3</source>
<translation type="unfinished"></translation>
</message>
@ -1421,7 +1421,12 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Icons.qml" line="51"/>
<location filename="qml/page/T_Icons.qml" line="28"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Icons.qml" line="61"/>
<source>You Copied </source>
<translation type="unfinished"></translation>
</message>
@ -2185,10 +2190,15 @@ Some contents...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Text.qml" line="18"/>
<location filename="qml/page/T_Text.qml" line="19"/>
<source>This is a text that can be copied</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Text.qml" line="29"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>T_TextBox</name>

View File

@ -929,7 +929,7 @@ Updated content:
<location filename="qml/page/T_Buttons.qml" line="199"/>
<location filename="qml/page/T_Buttons.qml" line="320"/>
<location filename="qml/page/T_Buttons.qml" line="368"/>
<location filename="qml/page/T_Buttons.qml" line="421"/>
<location filename="qml/page/T_Buttons.qml" line="419"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
@ -1049,12 +1049,12 @@ Updated content:
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Buttons.qml" line="408"/>
<location filename="qml/page/T_Buttons.qml" line="407"/>
<source>Radio Button_2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Buttons.qml" line="412"/>
<location filename="qml/page/T_Buttons.qml" line="410"/>
<source>Radio Button_3</source>
<translation type="unfinished"></translation>
</message>
@ -1538,12 +1538,17 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<source>Please enter a keyword</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Icons.qml" line="28"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search</source>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="qml/page/T_Icons.qml" line="51"/>
<location filename="qml/page/T_Icons.qml" line="61"/>
<source>You Copied </source>
<translation type="unfinished"></translation>
</message>
@ -2367,10 +2372,15 @@ Some contents...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Text.qml" line="18"/>
<location filename="qml/page/T_Text.qml" line="19"/>
<source>This is a text that can be copied</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Text.qml" line="29"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>T_TextBox</name>

View File

@ -399,16 +399,14 @@ FluScrollablePage{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluRadioButton{
disabled: radio_button_switch.checked
FluRadioButton{
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")
}
}

View File

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

View File

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

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

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

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

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

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