2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
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-11-24 12:14:20 +00:00
|
|
|
|
2021-10-25 12:30:23 +00:00
|
|
|
import StatusQ.Controls 0.1 as StatusQControls
|
2024-10-15 19:26:12 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-25 12:30:23 +00:00
|
|
|
|
2020-11-24 12:14:20 +00:00
|
|
|
Rectangle {
|
|
|
|
id: root
|
2022-02-09 09:43:23 +00:00
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
property int padding: Theme.halfPadding
|
2020-11-24 12:14:20 +00:00
|
|
|
property alias control: radioControl
|
|
|
|
property alias image: img
|
2021-01-19 19:51:02 +00:00
|
|
|
property bool isHovered: false
|
2022-07-26 11:53:18 +00:00
|
|
|
signal radioCheckedChanged(bool checked)
|
2020-11-24 12:14:20 +00:00
|
|
|
|
2022-07-26 11:53:18 +00:00
|
|
|
implicitWidth: 208
|
|
|
|
implicitHeight: layout.height
|
2024-10-15 19:26:12 +00:00
|
|
|
color: radioControl.checked ? Theme.palette.secondaryBackground :
|
|
|
|
(isHovered ? Theme.palette.backgroundHover : Theme.palette.transparent)
|
2020-11-24 12:14:20 +00:00
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
radius: Theme.radius
|
2020-11-24 12:14:20 +00:00
|
|
|
|
2022-07-26 11:53:18 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
width: parent.width
|
|
|
|
spacing: root.padding
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: img
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.preferredWidth: root.width - root.padding*2
|
|
|
|
}
|
2020-11-24 12:14:20 +00:00
|
|
|
|
2022-07-26 11:53:18 +00:00
|
|
|
StatusQControls.StatusRadioButton {
|
|
|
|
id: radioControl
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: root.padding
|
|
|
|
Layout.rightMargin: root.padding
|
|
|
|
}
|
2020-11-24 12:14:20 +00:00
|
|
|
}
|
2021-01-19 19:51:02 +00:00
|
|
|
|
|
|
|
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
|
|
|
}
|