mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 13:56:10 +00:00
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
|
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 {
|
StatusRadioButton {
|
||||||
id: radioButton
|
id: radioButton
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@ -40,18 +51,13 @@ Rectangle {
|
|||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
checked: root.checked
|
checked: root.checked
|
||||||
onCheckedChanged: root.radioCheckedChanged(checked)
|
onCheckedChanged: root.radioCheckedChanged(checked)
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
onPressed: mouse.accepted = false
|
||||||
onEntered: root.isHovered = true
|
onEntered: root.isHovered = true
|
||||||
onExited: root.isHovered = false
|
|
||||||
onClicked: {
|
|
||||||
if (!radioButton.checked) {
|
|
||||||
root.radioCheckedChanged(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user