chore: fixed select language listview

This commit is contained in:
vladimir.kuznetsov
2025-06-09 14:18:18 +08:00
parent 531e9b4fa6
commit 1c89d19b6d
4 changed files with 85 additions and 50 deletions

View File

@@ -30,30 +30,35 @@ Button {
}
}
contentItem: RowLayout {
anchors.fill: parent
implicitHeight: childrenRect.height
contentItem: Item {
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
Header3TextType {
id: headerText
Layout.fillWidth: true
Layout.leftMargin: 8
Layout.topMargin: 19
Layout.bottomMargin: 19
horizontalAlignment: Text.AlignLeft
text: buttonText
color: Style.color.black
}
RowLayout {
id: content
anchors.fill: parent
Item { Layout.fillWidth: true }
Header3TextType {
id: headerText
Layout.fillWidth: true
Layout.leftMargin: 8
Layout.topMargin: 19
Layout.bottomMargin: 19
horizontalAlignment: Text.AlignLeft
text: buttonText
color: Style.color.black
}
Image {
Layout.rightMargin: 8
source: "qrc:/images/controls/chevron-right.svg"
layer {
enabled: true
effect: ColorOverlay {
color: Style.color.black
Item { Layout.fillWidth: true }
Image {
Layout.rightMargin: 8
source: "qrc:/images/controls/chevron-right.svg"
layer {
enabled: true
effect: ColorOverlay {
color: Style.color.black
}
}
}
}

View File

@@ -43,9 +43,6 @@ Page {
ColumnLayout {
Layout.fillWidth: true
Layout.topMargin: 24
Layout.leftMargin: 8
Layout.rightMargin: 8
spacing: 2
SettingsButtonNoBorder {
buttonText: qsTr("Language")

View File

@@ -57,7 +57,6 @@ Page {
ScrollBar.vertical: ScrollBar {}
delegate: Item {
id: menuContentDelegate
required property string countryName
required property string countryCode
required property string countryImageCode
@@ -142,4 +141,4 @@ Page {
}
}
}
}
}

View File

@@ -50,51 +50,85 @@ Page {
model: LanguageModel
currentIndex: LanguageModel.currentLanguageIndex
spacing: 8
ScrollBar.vertical: ScrollBar {}
delegate: Item {
id: languageItem
required property string languageName
required property int languageIndex
required property int index
width: languageListView.width
height: 60
implicitWidth: languageListView.width
implicitHeight: languageItem.implicitHeight
visible: languageName === "English" || languageName === "Русский"
Rectangle {
RadioButton {
id: languageItem
anchors.fill: parent
color: radioButton.checked ? Style.color.gray1 : Style.color.transparent
radius: 8
anchors.rightMargin: 16
anchors.leftMargin: 16
RowLayout {
anchors.fill: parent
anchors.margins: 8
ButtonGroup.group: languageButtonGroup
RadioButton {
id: radioButton
ButtonGroup.group: languageButtonGroup
checked: languageIndex === LanguageModel.currentLanguageIndex
checked: languageIndex === LanguageModel.currentLanguageIndex
text: languageName
font.pixelSize: 18
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
indicator: Item { }
onClicked: {
if (languageIndex !== LanguageModel.currentLanguageIndex) {
LanguageModel.changeLanguage(languageIndex);
PageController.closePage();
}
contentItem: Item {
id: contentContainer
anchors.left: parent.left
anchors.right: parent.right
implicitHeight: content.implicitHeight
Rectangle {
anchors.fill: parent
radius: 8
color: languageItem.checked ? Style.color.gray1 : Style.color.transparent
}
RowLayout {
id: content
anchors.fill: parent
Header3TextType {
Layout.fillWidth: true
Layout.leftMargin: 8
Layout.topMargin: 19
Layout.bottomMargin: 19
text: languageName
color: languageItem.hovered ? Style.color.gray9 : Style.color.black
}
Image {
Layout.rightMargin: 8
width: 24
height: 24
source: "qrc:/images/controls/check.svg"
visible: languageItem.checked
}
}
}
onClicked: {
if (languageIndex !== LanguageModel.currentLanguageIndex) {
LanguageModel.changeLanguage(languageIndex);
PageController.closePage();
}
}
MouseArea {
anchors.fill: languageItem
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
}
}
}
}