2023-02-24 18:44:29 +08:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
2023-02-28 18:29:00 +08:00
|
|
|
|
import FluentUI 1.0
|
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
|
|
|
|
|
|
|
|
|
|
background: Rectangle{
|
|
|
|
|
radius: 4
|
|
|
|
|
FluFocusRectangle{
|
|
|
|
|
visible: control.visualFocus
|
|
|
|
|
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-02-24 18:44:29 +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
|
|
|
|
}
|
|
|
|
|
|
2023-03-12 14:26:03 +08:00
|
|
|
|
|
2023-02-24 18:44:29 +08:00
|
|
|
|
}
|