Add and delete works now!
This commit is contained in:
56
main.qml
56
main.qml
@@ -37,23 +37,53 @@ Kirigami.ApplicationWindow {
|
||||
contentItem: Item {
|
||||
implicitWidth: delegateLayout.implicitWidth
|
||||
implicitHeight: delegateLayout.implicitHeight
|
||||
RowLayout {
|
||||
id: delegateLayout
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text: flightCategory
|
||||
}
|
||||
Controls.Label {
|
||||
text: rawMetar
|
||||
ColumnLayout {
|
||||
id: delegateLayout
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Kirigami.Heading {
|
||||
text: stationId
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text: flightCategory
|
||||
|
||||
// Dynamically set the color based on the flight category
|
||||
Component.onCompleted: {
|
||||
color = Qt.binding(function() {
|
||||
if (flightCategory == "VFR") {
|
||||
return "green";
|
||||
} else if (flightCategory == "MVFR") {
|
||||
return "blue";
|
||||
} else if (flightCategory == "IFR") {
|
||||
return "red";
|
||||
} else if (flightCategory == "LIFR") {
|
||||
return "fuchsia";
|
||||
} else {
|
||||
return "white";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Controls.Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
icon.name: "edit-delete"
|
||||
onClicked: logic.deleteAirport(stationId)
|
||||
}
|
||||
}
|
||||
Controls.Label {
|
||||
text: rawMetar
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.OverlaySheet {
|
||||
id: addAirport
|
||||
|
||||
Reference in New Issue
Block a user