Master/detail version brutasse

main
Francois DELOBEL 4 weeks ago
parent eb5e628ed7
commit ad9305e422

@ -0,0 +1,32 @@
import QtQuick 2.15
Rectangle {
width: lv.width
height: 30
required property string name
required property string iso
Text {
text: parent.name
font.pixelSize: 20
anchors.verticalCenter: parent.verticalCenter
}
Image {
id: flag
source: "qrc:/assets/flags/"+parent.iso+".svg"
height: parent.height - 4
anchors.right: parent.right
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
onClicked: {
choosenText.text = name
choosenFlag.source = flag.source
}
}
}

@ -9,24 +9,35 @@ Window {
ListView {
id: lv
anchors.fill: parent
anchors.left: parent.left
height: parent.height
width: parent.width / 3
model: countries
delegate: Rectangle {
width: lv.width/3
height: 30
delegate: Country {
Text {
text: name
font.pixelSize: 20
anchors.verticalCenter: parent.verticalCenter
}
}
}
Rectangle {
anchors.right: parent.right
anchors.left: lv.right
height: parent.height
color: "lightgrey"
Column {
width: parent.width
Image {
source: "qrc:/assets/flags/"+iso+".svg"
height: parent.height - 4
anchors.right: parent.right
id: choosenFlag
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
width: parent.width
}
Text {
id: choosenText
text: ""
font.pixelSize: 50
anchors.horizontalCenter: parent.horizontalCenter
}
}
}

@ -203,5 +203,6 @@
<file>assets/data_en-GB.xml</file>
<file>assets/map.svg</file>
<file>assets/map.svg.txt</file>
<file>Country.qml</file>
</qresource>
</RCC>

Loading…
Cancel
Save