This commit is contained in:
zhuzichu 2023-06-21 16:12:07 +08:00
parent 243f8aa248
commit 1c0f5acaf8
3 changed files with 23 additions and 7 deletions

View File

@ -24,7 +24,6 @@ ComboBox {
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
palette.text: control.palette.text palette.text: control.palette.text
palette.highlightedText: control.palette.highlightedText palette.highlightedText: control.palette.highlightedText
font.bold: control.currentIndex === index
highlighted: control.highlightedIndex === index highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled hoverEnabled: control.hoverEnabled
} }

View File

@ -9,8 +9,8 @@ Button {
property bool disabled: false property bool disabled: false
property int radius:4 property int radius:4
property string contentDescription: "" 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 hoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : 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 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 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 disableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
property color color: { property color color: {

View File

@ -10,6 +10,10 @@ Button {
property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.15) : Qt.lighter(normalColor,1.15) 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 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 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 bool textBold: true
property color textColor: { property color textColor: {
if(!enabled){ if(!enabled){
@ -21,12 +25,25 @@ Button {
return hovered ? hoverColor :normalColor return hovered ? hoverColor :normalColor
} }
id: control id: control
horizontalPadding:2 horizontalPadding:6
enabled: !disabled enabled: !disabled
Keys.onSpacePressed: control.visualFocus&&clicked() font:FluTextStyle.Body
background: Item{ background: Rectangle{
implicitWidth: 28 implicitWidth: 28
implicitHeight: 28 implicitHeight: 28
radius: 4
color: {
if(!enabled){
return backgroundDisableColor
}
if(pressed){
return backgroundPressedColor
}
if(hovered){
return backgroundHoverColor
}
return backgroundNormalColor
}
FluFocusRectangle{ FluFocusRectangle{
visible: control.visualFocus visible: control.visualFocus
radius:8 radius:8
@ -40,9 +57,9 @@ Button {
contentItem: FluText { contentItem: FluText {
id:btn_text id:btn_text
text: control.text text: control.text
font: control.font
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.bold: control.textBold
color: control.textColor color: control.textColor
} }
} }