2023-03-24 20:44:38 +08:00
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import FluentUI
|
2023-02-24 18:44:29 +08:00
|
|
|
|
|
2023-03-12 21:49:11 +08:00
|
|
|
|
Button {
|
2023-03-12 14:26:03 +08:00
|
|
|
|
id: control
|
2023-02-24 18:44:29 +08:00
|
|
|
|
|
|
|
|
|
property bool disabled: false
|
2023-03-12 14:26:03 +08:00
|
|
|
|
property color normalColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
|
|
|
|
property color hoverColor: FluTheme.isDark ? Qt.darker(normalColor,1.1) : Qt.lighter(normalColor,1.1)
|
|
|
|
|
property color disableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
|
|
|
|
|
2023-03-12 21:49:11 +08:00
|
|
|
|
enabled: !disabled
|
2023-03-12 14:26:03 +08:00
|
|
|
|
topPadding:5
|
|
|
|
|
bottomPadding:5
|
|
|
|
|
leftPadding:15
|
|
|
|
|
rightPadding:15
|
2023-03-12 22:36:31 +08:00
|
|
|
|
Keys.onSpacePressed: control.visualFocus&&clicked()
|
|
|
|
|
focusPolicy:Qt.TabFocus
|
2023-03-12 14:26:03 +08:00
|
|
|
|
background: Rectangle{
|
|
|
|
|
radius: 4
|
|
|
|
|
FluFocusRectangle{
|
2023-03-12 22:36:31 +08:00
|
|
|
|
visible: control.visualFocus
|
2023-03-12 14:26:03 +08:00
|
|
|
|
radius:8
|
|
|
|
|
}
|
|
|
|
|
color:{
|
2023-02-28 18:29:00 +08:00
|
|
|
|
if(disabled){
|
2023-03-12 14:26:03 +08:00
|
|
|
|
return disableColor
|
2023-02-28 18:29:00 +08:00
|
|
|
|
}
|
2023-03-12 14:26:03 +08:00
|
|
|
|
return hovered ? hoverColor :normalColor
|
2023-02-26 23:47:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-12 14:26:03 +08:00
|
|
|
|
contentItem: FluText {
|
|
|
|
|
text: control.text
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2023-02-28 18:29:00 +08:00
|
|
|
|
color: {
|
2023-03-06 14:22:13 +08:00
|
|
|
|
if(FluTheme.isDark){
|
2023-02-28 18:29:00 +08:00
|
|
|
|
if(disabled){
|
|
|
|
|
return Qt.rgba(173/255,173/255,173/255,1)
|
|
|
|
|
}
|
|
|
|
|
return Qt.rgba(0,0,0,1)
|
|
|
|
|
}else{
|
|
|
|
|
return Qt.rgba(1,1,1,1)
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-27 18:46:39 +08:00
|
|
|
|
font.pixelSize: 14
|
2023-02-24 18:44:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|