From 1c0f5acaf89ae4794f7aa252624ae89c2f2ea690 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Wed, 21 Jun 2023 16:12:07 +0800 Subject: [PATCH] update --- src/imports/FluentUI/Controls/FluComboBox.qml | 1 - .../FluentUI/Controls/FluIconButton.qml | 4 +-- .../FluentUI/Controls/FluTextButton.qml | 25 ++++++++++++++++--- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/imports/FluentUI/Controls/FluComboBox.qml b/src/imports/FluentUI/Controls/FluComboBox.qml index 7d2e64da..3e16553d 100644 --- a/src/imports/FluentUI/Controls/FluComboBox.qml +++ b/src/imports/FluentUI/Controls/FluComboBox.qml @@ -24,7 +24,6 @@ ComboBox { text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData palette.text: control.palette.text palette.highlightedText: control.palette.highlightedText - font.bold: control.currentIndex === index highlighted: control.highlightedIndex === index hoverEnabled: control.hoverEnabled } diff --git a/src/imports/FluentUI/Controls/FluIconButton.qml b/src/imports/FluentUI/Controls/FluIconButton.qml index 04fd0b55..7214313b 100644 --- a/src/imports/FluentUI/Controls/FluIconButton.qml +++ b/src/imports/FluentUI/Controls/FluIconButton.qml @@ -9,8 +9,8 @@ Button { property bool disabled: false property int radius:4 property string contentDescription: "" - property color hoverColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.03) - property color pressedColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.06) + property color hoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03) + property color pressedColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) property color normalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) property color disableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) property color color: { diff --git a/src/imports/FluentUI/Controls/FluTextButton.qml b/src/imports/FluentUI/Controls/FluTextButton.qml index 4944d94d..d111e138 100644 --- a/src/imports/FluentUI/Controls/FluTextButton.qml +++ b/src/imports/FluentUI/Controls/FluTextButton.qml @@ -10,6 +10,10 @@ Button { property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.15) : Qt.lighter(normalColor,1.15) property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.3) : Qt.lighter(normalColor,1.3) property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1) + property color backgroundHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03) + property color backgroundPressedColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06) + property color backgroundNormalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) + property color backgroundDisableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0) property bool textBold: true property color textColor: { if(!enabled){ @@ -21,12 +25,25 @@ Button { return hovered ? hoverColor :normalColor } id: control - horizontalPadding:2 + horizontalPadding:6 enabled: !disabled - Keys.onSpacePressed: control.visualFocus&&clicked() - background: Item{ + font:FluTextStyle.Body + background: Rectangle{ implicitWidth: 28 implicitHeight: 28 + radius: 4 + color: { + if(!enabled){ + return backgroundDisableColor + } + if(pressed){ + return backgroundPressedColor + } + if(hovered){ + return backgroundHoverColor + } + return backgroundNormalColor + } FluFocusRectangle{ visible: control.visualFocus radius:8 @@ -40,9 +57,9 @@ Button { contentItem: FluText { id:btn_text text: control.text + font: control.font horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - font.bold: control.textBold color: control.textColor } }