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;