fix: fix language list view scrollbar and binding loop

This commit is contained in:
Jonathan Rainville 2021-03-25 15:01:59 -04:00 committed by Iuri Matias
parent 3813a1a330
commit 012b5dc8a0
1 changed files with 7 additions and 9 deletions

View File

@ -18,39 +18,37 @@ ModalPopup {
Item { Item {
anchors.fill: parent anchors.fill: parent
ButtonGroup {
id: languageGroup
}
ScrollView { ScrollView {
width: parent.width width: parent.width
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: Style.current.padding anchors.topMargin: Style.current.padding
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.bigPadding anchors.bottomMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: 16
anchors.right: parent.right
anchors.rightMargin: 16
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOn ScrollBar.vertical.policy: ScrollBar.AlwaysOn
clip: true clip: true
ButtonGroup {
id: languageGroup
}
ListView { ListView {
id: languagesListView id: languagesListView
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
anchors.leftMargin: Style.current.padding
model: Locales_JSON.locales model: Locales_JSON.locales
spacing: 0 spacing: 0
delegate: Component { delegate: Component {
StatusRadioButtonRow { StatusRadioButtonRow {
height: 64 height: 64
anchors.rightMargin: 0
text: modelData.name text: modelData.name
buttonGroup: languageGroup buttonGroup: languageGroup
checked: appSettings.locale === modelData.locale checked: appSettings.locale === modelData.locale
onRadioCheckedChanged: { onRadioCheckedChanged: {
if (checked) { if (checked && appSettings.locale !== modelData.locale) {
profileModel.changeLocale(modelData.locale) profileModel.changeLocale(modelData.locale)
appSettings.locale = modelData.locale appSettings.locale = modelData.locale
} }