2023-02-24 18:44:29 +08:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: button
|
|
|
|
|
|
2023-02-28 18:29:00 +08:00
|
|
|
|
property string text: "Standard Button"
|
2023-02-24 18:44:29 +08:00
|
|
|
|
property int startPadding : 15
|
|
|
|
|
property int endPadding : 15
|
|
|
|
|
property int topPadding: 8
|
|
|
|
|
property int bottomPadding: 8
|
|
|
|
|
property bool disabled: false
|
2023-02-27 18:46:39 +08:00
|
|
|
|
property color primaryColor : "#0064B0"
|
2023-02-26 23:47:07 +08:00
|
|
|
|
signal clicked
|
2023-02-24 18:44:29 +08:00
|
|
|
|
radius: 4
|
2023-03-05 23:39:13 +08:00
|
|
|
|
|
2023-02-27 18:46:39 +08:00
|
|
|
|
color:{
|
2023-03-06 14:22:13 +08:00
|
|
|
|
if(FluTheme.isDark){
|
2023-02-27 18:46:39 +08:00
|
|
|
|
if(disabled){
|
2023-02-28 18:29:00 +08:00
|
|
|
|
return Qt.rgba(59/255,59/255,59/255,1)
|
2023-02-27 18:46:39 +08:00
|
|
|
|
}
|
|
|
|
|
return button_mouse.containsMouse ? "#444444" : "#3e3e3e"
|
|
|
|
|
}else{
|
|
|
|
|
if(disabled){
|
2023-02-28 18:29:00 +08:00
|
|
|
|
return Qt.rgba(252/255,252/255,252/255,1)
|
2023-02-27 18:46:39 +08:00
|
|
|
|
}
|
|
|
|
|
return button_mouse.containsMouse ? "#FBFBFB" : "#FFFFFF"
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-26 23:47:07 +08:00
|
|
|
|
width: button_text.implicitWidth
|
|
|
|
|
height: button_text.implicitHeight
|
2023-02-27 18:46:39 +08:00
|
|
|
|
|
2023-03-06 14:22:13 +08:00
|
|
|
|
border.color: FluTheme.isDark ? "#505050" : "#DFDFDF"
|
2023-02-24 18:44:29 +08:00
|
|
|
|
border.width: 1
|
|
|
|
|
|
2023-02-27 18:46:39 +08:00
|
|
|
|
|
|
|
|
|
FluText {
|
2023-02-26 23:47:07 +08:00
|
|
|
|
id: button_text
|
2023-02-28 18:29:00 +08:00
|
|
|
|
text: button.text
|
2023-02-27 18:46:39 +08:00
|
|
|
|
font.pixelSize: 14
|
2023-02-24 18:44:29 +08:00
|
|
|
|
leftPadding: button.startPadding
|
|
|
|
|
rightPadding: button.endPadding
|
|
|
|
|
topPadding: button.topPadding
|
|
|
|
|
bottomPadding: button.bottomPadding
|
|
|
|
|
anchors.centerIn: parent
|
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(131/255,131/255,131/255,1)
|
|
|
|
|
}
|
|
|
|
|
return Qt.rgba(1,1,1,1)
|
|
|
|
|
}else{
|
|
|
|
|
if(disabled){
|
|
|
|
|
return Qt.rgba(160/255,160/255,160/255,1)
|
|
|
|
|
}
|
|
|
|
|
return Qt.rgba(0,0,0,1)
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-24 18:44:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
2023-02-26 23:47:07 +08:00
|
|
|
|
id:button_mouse
|
2023-02-24 18:44:29 +08:00
|
|
|
|
anchors.fill: parent
|
2023-02-26 23:47:07 +08:00
|
|
|
|
hoverEnabled: true
|
2023-03-09 11:50:40 +08:00
|
|
|
|
enabled: !disabled
|
2023-02-24 18:44:29 +08:00
|
|
|
|
onClicked: {
|
2023-02-26 23:47:07 +08:00
|
|
|
|
button.clicked()
|
2023-02-24 18:44:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|