WizardWelcome: ListView replaced with GridView

This commit is contained in:
Ilya Kitaev 2016-01-25 16:39:52 +03:00
parent 04302ec96d
commit 965a8759f0

View file

@ -79,8 +79,10 @@ Item {
XmlRole { name: "isCurrent"; query: "@enabled/string()" } XmlRole { name: "isCurrent"; query: "@enabled/string()" }
} }
ListView { GridView {
id: listView id: gridView
cellWidth: 140
cellHeight: 120
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -89,20 +91,20 @@ Item {
anchors.leftMargin: 16 anchors.leftMargin: 16
anchors.rightMargin: 16 anchors.rightMargin: 16
clip: true clip: true
model: languagesModel model: languagesModel
delegate: Item { delegate: Item {
width: listView.width id: flagDelegate
height: 80 width: gridView.cellWidth
height: gridView.cellHeight
Rectangle { Rectangle {
id: flagRect id: flagRect
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
width: 60; height: 60 width: 60; height: 60
anchors.centerIn: parent
radius: 30 radius: 30
color: listView.currentIndex === index ? "#DBDBDB" : "#FFFFFF" color: gridView.currentIndex === index ? "#DBDBDB" : "#FFFFFF"
Image { Image {
anchors.centerIn: parent anchors.centerIn: parent
source: "file:///" + applicationDirectory + flag source: "file:///" + applicationDirectory + flag
@ -110,30 +112,20 @@ Item {
} }
Text { Text {
anchors.verticalCenter: parent.verticalCenter
anchors.left: flagRect.right
anchors.right: parent.right
anchors.leftMargin: 16
font.family: "Arial" font.family: "Arial"
font.pixelSize: 24 font.pixelSize: 24
font.bold: listView.currentIndex === index anchors.horizontalCenter: parent.horizontalCenter
anchors.top: flagRect.bottom
anchors.topMargin: 10
font.bold: gridView.currentIndex === index
elide: Text.ElideRight elide: Text.ElideRight
color: "#3F3F3F" color: "#3F3F3F"
text: name text: name
} }
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 1
color: "#DBDBDB"
}
MouseArea { MouseArea {
id: delegateArea id: delegateArea
anchors.fill: parent anchors.fill: parent
onClicked: listView.currentIndex = index onClicked: gridView.currentIndex = index
} }
} }
} }