2020-07-15 19:38:03 +00:00
|
|
|
import QtQuick 2.13
|
2021-03-16 19:19:48 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
2020-07-15 19:38:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
2021-10-05 20:50:22 +00:00
|
|
|
id: headerButton
|
|
|
|
|
2020-07-15 19:38:03 +00:00
|
|
|
property string text: ""
|
|
|
|
property url imageSource
|
|
|
|
property bool flipImage: false
|
|
|
|
property var onClicked: function () {}
|
2021-10-05 20:50:22 +00:00
|
|
|
property int margin: 8
|
2020-07-15 19:38:03 +00:00
|
|
|
|
|
|
|
width: buttonImage.width + buttonText.width + Style.current.smallPadding * 2
|
2021-10-05 20:50:22 +00:00
|
|
|
+ (text === "" ? 0 : headerButton.margin)
|
2020-07-15 19:38:03 +00:00
|
|
|
height: buttonText.height + Style.current.smallPadding * 2
|
|
|
|
border.width: 0
|
|
|
|
color: Style.current.transparent
|
|
|
|
radius: Style.current.radius
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: buttonImage
|
|
|
|
height: 18
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: imageSource
|
|
|
|
rotation: flipImage ? 180 : 0
|
2021-03-16 19:19:48 +00:00
|
|
|
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: parent
|
|
|
|
source: parent
|
|
|
|
color: Style.current.primary
|
|
|
|
}
|
2020-07-15 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: buttonText
|
|
|
|
visible: !!headerButton.text
|
|
|
|
text: headerButton.text
|
|
|
|
anchors.left: buttonImage.right
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.leftMargin: headerButton.margin
|
2020-07-15 19:38:03 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: 13
|
2022-09-15 15:23:51 +00:00
|
|
|
font.family: Style.current.baseFont.name
|
2021-01-12 11:16:09 +00:00
|
|
|
font.weight: Font.Medium
|
2020-07-15 19:38:03 +00:00
|
|
|
color: Style.current.blue
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
2021-01-12 11:16:09 +00:00
|
|
|
parent.color = Style.current.secondaryBackground
|
2020-07-15 19:38:03 +00:00
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
parent.color = Style.current.transparent
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
headerButton.onClicked()
|
|
|
|
}
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
}
|
|
|
|
}
|