2023-02-24 18:44:29 +08:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
import QtQuick.Controls.Material 2.15
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: button
|
|
|
|
|
|
|
|
|
|
property int startPadding : 15
|
|
|
|
|
property int endPadding : 15
|
|
|
|
|
property int topPadding: 8
|
|
|
|
|
property int bottomPadding: 8
|
|
|
|
|
property bool disabled: false
|
2023-02-26 23:47:07 +08:00
|
|
|
|
property color primaryColor : "#0064B0"
|
|
|
|
|
signal clicked
|
2023-02-24 18:44:29 +08:00
|
|
|
|
radius: 4
|
2023-02-26 23:47:07 +08:00
|
|
|
|
color:{
|
|
|
|
|
if(disabled){
|
|
|
|
|
return "#C7C7C7"
|
|
|
|
|
}
|
|
|
|
|
return button_mouse.containsMouse ? Qt.lighter(primaryColor,1.15) : primaryColor
|
|
|
|
|
}
|
|
|
|
|
width: button_text.implicitWidth
|
|
|
|
|
height: button_text.implicitHeight
|
|
|
|
|
border.color: "#cccccc"
|
2023-02-24 18:44:29 +08:00
|
|
|
|
border.width: 1
|
|
|
|
|
|
|
|
|
|
Text {
|
2023-02-26 23:47:07 +08:00
|
|
|
|
id: button_text
|
2023-02-24 18:44:29 +08:00
|
|
|
|
text: "Standard Button"
|
2023-02-26 23:47:07 +08:00
|
|
|
|
color: "#FFFFFFFF"
|
2023-02-24 18:44:29 +08:00
|
|
|
|
font.pixelSize: 13
|
|
|
|
|
leftPadding: button.startPadding
|
|
|
|
|
rightPadding: button.endPadding
|
|
|
|
|
topPadding: button.topPadding
|
|
|
|
|
bottomPadding: button.bottomPadding
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-02-24 18:44:29 +08:00
|
|
|
|
onClicked: {
|
2023-02-26 23:47:07 +08:00
|
|
|
|
if(disabled)
|
|
|
|
|
return
|
|
|
|
|
button.clicked()
|
2023-02-24 18:44:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|