status-desktop/ui/shared/status/StatusImageRadioButton.qml

57 lines
1.4 KiB
QML
Raw Normal View History

2020-11-24 12:14:20 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Controls.Universal 2.12
import utils 1.0
2020-11-24 12:14:20 +00:00
import "../../shared"
import "../../shared/panels"
2020-11-24 12:14:20 +00:00
import "./"
import StatusQ.Controls 0.1 as StatusQControls
2020-11-24 12:14:20 +00:00
Rectangle {
id: root
property int padding: Style.current.padding
property alias control: radioControl
property alias image: img
property bool isHovered: false
signal radioCheckedChanged(checked: bool)
2020-11-24 12:14:20 +00:00
width: 312
height: 258
color: radioControl.checked ? Style.current.secondaryBackground :
(isHovered ? Style.current.backgroundHover : Style.current.transparent)
2020-11-24 12:14:20 +00:00
radius: Style.current.radius
SVGImage {
id: img
anchors.top: parent.top
anchors.topMargin: root.padding
anchors.left: parent.left
anchors.leftMargin: root.padding
anchors.right: parent.right
anchors.rightMargin: root.padding
}
StatusQControls.StatusRadioButton {
2020-11-24 12:14:20 +00:00
id: radioControl
anchors.top: img.bottom
anchors.topMargin: root.padding
anchors.left: parent.left
anchors.leftMargin: root.padding
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: root.isHovered = true
onExited: root.isHovered = false
onClicked: {
root.radioCheckedChanged(!radioControl.checked)
}
cursorShape: Qt.PointingHandCursor
}
2020-11-24 12:14:20 +00:00
}