1
0
Fork 0

Launcher: FlightPlann: fix ‘view route’ enable

This commit is contained in:
Automatic Release Builder 2020-12-06 18:45:44 +00:00 committed by James Turner
parent 499dc79584
commit 769dcb1454
2 changed files with 13 additions and 0 deletions

View file

@ -32,12 +32,15 @@ const int LegAltitudeTypeRole = Qt::UserRole + 8;
class LegsModel : public QAbstractListModel class LegsModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(int numLegs READ numLegs NOTIFY numLegsChanged)
public: public:
void setFlightPlan(flightgear::FlightPlanRef f) void setFlightPlan(flightgear::FlightPlanRef f)
{ {
beginResetModel(); beginResetModel();
_fp = f; _fp = f;
endResetModel(); endResetModel();
emit numLegsChanged();
} }
int rowCount(const QModelIndex &parent) const override int rowCount(const QModelIndex &parent) const override
@ -132,6 +135,7 @@ public:
{ {
beginResetModel(); beginResetModel();
endResetModel(); endResetModel();
numLegsChanged();
} }
QHash<int, QByteArray> roleNames() const override QHash<int, QByteArray> roleNames() const override
@ -152,6 +156,14 @@ public:
return result; return result;
} }
int numLegs() const
{
return _fp->numLegs();
}
signals:
void numLegsChanged();
private: private:
flightgear::FlightPlanRef _fp; flightgear::FlightPlanRef _fp;
}; };

View file

@ -322,6 +322,7 @@ Item {
Button { Button {
text: qsTr("View route") text: qsTr("View route")
enabled: _launcher.flightPlan.legs.numLegs > 0
onClicked: { onClicked: {
detailLoader.airportGuid = 0 detailLoader.airportGuid = 0
detailLoader.sourceComponent = routeDetails; detailLoader.sourceComponent = routeDetails;