From 769dcb1454126ad2a8b199a273543d9cf71daa8d Mon Sep 17 00:00:00 2001 From: Automatic Release Builder Date: Sun, 6 Dec 2020 18:45:44 +0000 Subject: [PATCH] =?UTF-8?q?Launcher:=20FlightPlann:=20fix=20=E2=80=98view?= =?UTF-8?q?=20route=E2=80=99=20enable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/GUI/FlightPlanController.cxx | 12 ++++++++++++ src/GUI/qml/FlightPlan.qml | 1 + 2 files changed, 13 insertions(+) diff --git a/src/GUI/FlightPlanController.cxx b/src/GUI/FlightPlanController.cxx index 7e8b8ca6f..02fcaffcb 100644 --- a/src/GUI/FlightPlanController.cxx +++ b/src/GUI/FlightPlanController.cxx @@ -32,12 +32,15 @@ const int LegAltitudeTypeRole = Qt::UserRole + 8; class LegsModel : public QAbstractListModel { Q_OBJECT + + Q_PROPERTY(int numLegs READ numLegs NOTIFY numLegsChanged) public: void setFlightPlan(flightgear::FlightPlanRef f) { beginResetModel(); _fp = f; endResetModel(); + emit numLegsChanged(); } int rowCount(const QModelIndex &parent) const override @@ -132,6 +135,7 @@ public: { beginResetModel(); endResetModel(); + numLegsChanged(); } QHash roleNames() const override @@ -152,6 +156,14 @@ public: return result; } + int numLegs() const + { + return _fp->numLegs(); + } + +signals: + void numLegsChanged(); + private: flightgear::FlightPlanRef _fp; }; diff --git a/src/GUI/qml/FlightPlan.qml b/src/GUI/qml/FlightPlan.qml index 13d287318..af1051fef 100644 --- a/src/GUI/qml/FlightPlan.qml +++ b/src/GUI/qml/FlightPlan.qml @@ -322,6 +322,7 @@ Item { Button { text: qsTr("View route") + enabled: _launcher.flightPlan.legs.numLegs > 0 onClicked: { detailLoader.airportGuid = 0 detailLoader.sourceComponent = routeDetails;