diff --git a/2024/idees_tp/flags/Country.qml b/2024/idees_tp/flags/Country.qml
new file mode 100644
index 0000000..365b734
--- /dev/null
+++ b/2024/idees_tp/flags/Country.qml
@@ -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
+ }
+ }
+}
diff --git a/2024/idees_tp/flags/main.qml b/2024/idees_tp/flags/main.qml
index 4e15e64..380d7fc 100644
--- a/2024/idees_tp/flags/main.qml
+++ b/2024/idees_tp/flags/main.qml
@@ -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
}
}
}
diff --git a/2024/idees_tp/flags/qml.qrc b/2024/idees_tp/flags/qml.qrc
index 99c10ef..2b6dc06 100644
--- a/2024/idees_tp/flags/qml.qrc
+++ b/2024/idees_tp/flags/qml.qrc
@@ -203,5 +203,6 @@
assets/data_en-GB.xml
assets/map.svg
assets/map.svg.txt
+ Country.qml