2021-08-13 20:04:04 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-08-13 20:04:04 +00:00
|
|
|
import "../../../../shared"
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: headerButton
|
|
|
|
width: buttonImage.width + buttonText.width + Style.current.smallPadding * 2
|
2021-09-14 16:23:02 +00:00
|
|
|
+ (text === "" ? 0 : headerButton.btnMargin)
|
2021-08-13 20:04:04 +00:00
|
|
|
height: buttonText.height + Style.current.smallPadding * 2
|
|
|
|
border.width: 0
|
|
|
|
color: Style.current.transparent
|
|
|
|
radius: Style.current.radius
|
|
|
|
|
2021-09-14 16:23:02 +00:00
|
|
|
property int btnMargin
|
|
|
|
property string text: ""
|
|
|
|
property url imageSource
|
|
|
|
property bool flipImage: false
|
|
|
|
signal clicked()
|
|
|
|
|
2021-08-13 20:04:04 +00:00
|
|
|
SVGImage {
|
|
|
|
id: buttonImage
|
|
|
|
height: 18
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
fillMode: Image.PreserveAspectFit
|
2021-09-14 16:23:02 +00:00
|
|
|
source: headerButton.imageSource
|
2021-08-13 20:04:04 +00:00
|
|
|
rotation: flipImage ? 180 : 0
|
|
|
|
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: parent
|
|
|
|
source: parent
|
|
|
|
color: Style.current.primary
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: buttonText
|
|
|
|
visible: !!headerButton.text
|
|
|
|
text: headerButton.text
|
|
|
|
anchors.left: buttonImage.right
|
2021-09-14 16:23:02 +00:00
|
|
|
anchors.leftMargin: headerButton.btnMargin
|
2021-08-13 20:04:04 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.family: Style.current.fontMedium.name
|
|
|
|
font.weight: Font.Medium
|
|
|
|
color: Style.current.blue
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
2021-09-14 16:23:02 +00:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
2021-08-13 20:04:04 +00:00
|
|
|
onEntered: {
|
2021-09-14 16:23:02 +00:00
|
|
|
headerButton.color = Style.current.secondaryBackground;
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
|
|
|
onExited: {
|
2021-09-14 16:23:02 +00:00
|
|
|
headerButton.color = Style.current.transparent;
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
|
|
|
onClicked: {
|
2021-09-14 16:23:02 +00:00
|
|
|
headerButton.clicked();
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|