2022-09-09 22:09:37 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
2023-01-20 11:04:12 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-09-09 22:09:37 +00:00
|
|
|
StatusListItem {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property ButtonGroup buttonGroup
|
|
|
|
property alias checked: radioButton.checked
|
|
|
|
readonly property alias radioButton: radioButton
|
|
|
|
|
|
|
|
implicitHeight: 44
|
|
|
|
leftPadding: 8
|
|
|
|
rightPadding: 9
|
|
|
|
statusListItemTitle.font.pixelSize: 13
|
|
|
|
|
|
|
|
statusListItemTitleArea.anchors.leftMargin: 8
|
|
|
|
|
|
|
|
asset.bgWidth: 32
|
|
|
|
asset.bgHeight: 32
|
|
|
|
|
2023-01-20 11:04:12 +00:00
|
|
|
Binding on asset.color {
|
|
|
|
when: !root.enabled
|
|
|
|
value: Style.current.darkGrey
|
|
|
|
}
|
|
|
|
|
2022-09-09 22:09:37 +00:00
|
|
|
components: [
|
|
|
|
StatusRadioButton {
|
|
|
|
id: radioButton
|
|
|
|
|
2023-01-20 11:04:12 +00:00
|
|
|
visible: root.enabled
|
|
|
|
|
2022-09-09 22:09:37 +00:00
|
|
|
// reference to root for better integration with ButtonGroup
|
|
|
|
// by accessing main component via ButtonGroup::checkedButton.item
|
|
|
|
readonly property alias item: root
|
|
|
|
|
|
|
|
size: StatusRadioButton.Size.Small
|
|
|
|
ButtonGroup.group: root.buttonGroup
|
|
|
|
|
|
|
|
rightPadding: 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
// using MouseArea instead of build-in 'clicked' signal to avoid
|
|
|
|
// intercepting event by the StatusRadioButton
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
if (!radioButton.checked)
|
|
|
|
radioButton.toggle()
|
|
|
|
}
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
}
|
|
|
|
}
|