status-desktop/ui/app/AppLayouts/Wallet/components/SetCurrencyModalContent.qml

91 lines
2.8 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
import "../data/"
Item {
property string currency: "USD"
2020-07-22 20:40:32 +00:00
id: modalBody
anchors.fill: parent
ButtonGroup {
id: currencyGroup
}
2020-07-22 20:40:32 +00:00
ListView {
anchors.top: parent.top
anchors.left: parent.left
2020-07-22 20:40:32 +00:00
anchors.right: parent.right
anchors.bottom: parent.bottom
2020-07-22 20:40:32 +00:00
clip: true
spacing: 10
id: tokenListView
model: Currencies {}
ScrollBar.vertical: ScrollBar {
active: true
policy: tokenListView.contentHeight > tokenListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
}
boundsBehavior: Flickable.StopAtBounds
2020-07-22 20:40:32 +00:00
delegate: Component {
Rectangle {
id: wrapper
property bool hovered: false
radius: Style.current.radius
color: modalBody.currency === key ? Style.current.secondaryBackground : (hovered ? Style.current.backgroundHover: Style.current.transparent)
2020-07-22 20:40:32 +00:00
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 10
width: parent.width
height: 52
StyledText {
text: name + " (" + code + ")"
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
2020-07-22 20:40:32 +00:00
}
StatusRadioButton {
id: currencyRadioBtn
2020-07-22 20:40:32 +00:00
checked: currency === key
isHovered: wrapper.hovered
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter
2020-07-22 20:40:32 +00:00
ButtonGroup.group: currencyGroup
onClicked: { walletModel.setDefaultCurrency(key) }
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onEntered: {
wrapper.hovered = true
}
onExited: {
wrapper.hovered = false
}
onClicked: {
currencyRadioBtn.checked = !currencyRadioBtn.checked
modalBody.currency = key
walletModel.setDefaultCurrency(key)
}
}
}
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/