fix(StatusRadioButtonRow): ensure checked state is propagated properly
There were cases in which this component was used and its `checked` state wasn't properly emitted to the underlying component. This commit fixes that by ensuring the `MouseArea` only alters the radio button's `checked` state and let the radio button handle the event propagation.
This commit is contained in:
parent
accf92be2f
commit
a27f9cf25d
|
@ -31,6 +31,17 @@ Rectangle {
|
|||
anchors.leftMargin: Style.current.padding
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: root.isHovered = true
|
||||
onExited: root.isHovered = false
|
||||
onClicked: {
|
||||
radioButton.checked = true
|
||||
}
|
||||
}
|
||||
|
||||
StatusRadioButton {
|
||||
id: radioButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
@ -40,18 +51,13 @@ Rectangle {
|
|||
rightPadding: 0
|
||||
checked: root.checked
|
||||
onCheckedChanged: root.radioCheckedChanged(checked)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: mouse.accepted = false
|
||||
onEntered: root.isHovered = true
|
||||
onExited: root.isHovered = false
|
||||
onClicked: {
|
||||
if (!radioButton.checked) {
|
||||
root.radioCheckedChanged(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue