fix(Wallet): fix bug that prevented users from setting the currency

Setting the default currency through the UI doesn't work because of a `MouseArea` that
is masking the an underlying `StatusRadioButton` which will tricker the default currency
change.

This commit enhances the `MouseArea` to trigger the default currency change and it
also ensures the UI is responding accordingly. Namely that the new default currency
is correcly selected in the list of currencies.

There's also a little change in the background hover color so it works well across
light and dark themes.

Fixes #1632
This commit is contained in:
Pascal Precht 2021-01-14 11:18:12 +01:00 committed by Iuri Matias
parent bc63c30ec2
commit c328f332f6
1 changed files with 8 additions and 1 deletions

View File

@ -35,7 +35,7 @@ Item {
id: wrapper id: wrapper
property bool hovered: false property bool hovered: false
radius: Style.current.radius radius: Style.current.radius
color: currency === key ? Style.current.lightBlue : (hovered ? Style.current.grey: Style.current.transparent) color: modalBody.currency === key ? Style.current.lightBlue : (hovered ? Style.current.backgroundHover: Style.current.transparent)
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.left: parent.left anchors.left: parent.left
@ -52,6 +52,7 @@ Item {
} }
StatusRadioButton { StatusRadioButton {
id: currencyRadioBtn
checked: currency === key checked: currency === key
isHovered: wrapper.hovered isHovered: wrapper.hovered
anchors.right: parent.right anchors.right: parent.right
@ -63,6 +64,7 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true hoverEnabled: true
onEntered: { onEntered: {
wrapper.hovered = true wrapper.hovered = true
@ -70,6 +72,11 @@ Item {
onExited: { onExited: {
wrapper.hovered = false wrapper.hovered = false
} }
onClicked: {
currencyRadioBtn.checked = !currencyRadioBtn.checked
modalBody.currency = key
walletModel.setDefaultCurrency(key)
}
} }
} }
} }