2020-09-25 12:13:40 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import "../../imports"
|
|
|
|
import "../../shared"
|
|
|
|
|
|
|
|
RoundButton {
|
|
|
|
id: control
|
|
|
|
|
|
|
|
property string type: "primary"
|
|
|
|
|
|
|
|
implicitHeight: 32
|
|
|
|
implicitWidth: 32
|
|
|
|
|
|
|
|
icon.height: 20
|
|
|
|
icon.width: 20
|
|
|
|
icon.color: (hovered || highlighted) ? Style.current.blue : Style.current.darkGrey
|
|
|
|
radius: Style.current.radius
|
|
|
|
|
|
|
|
onIconChanged: {
|
|
|
|
icon.source = icon.name ? "../../app/img/" + icon.name + ".svg" : ""
|
|
|
|
}
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
color: {
|
|
|
|
if (type === "secondary") {
|
|
|
|
return "transparent"
|
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
return hovered || highlighted ? Style.current.secondaryBackground : "transparent"
|
2020-09-25 12:13:40 +00:00
|
|
|
}
|
|
|
|
radius: control.radius
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: iconImg
|
|
|
|
visible: false
|
|
|
|
source: control.icon.source
|
|
|
|
height: control.icon.height
|
|
|
|
width: control.icon.width
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: iconImg
|
|
|
|
source: iconImg
|
|
|
|
color: control.icon.color
|
|
|
|
antialiasing: true
|
|
|
|
smooth: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onPressed: mouse.accepted = false
|
|
|
|
}
|
|
|
|
}
|