Launcher: FlightPlann: fix ‘view route’ enable
This commit is contained in:
parent
499dc79584
commit
769dcb1454
2 changed files with 13 additions and 0 deletions
|
@ -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<int, QByteArray> roleNames() const override
|
||||
|
@ -152,6 +156,14 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
int numLegs() const
|
||||
{
|
||||
return _fp->numLegs();
|
||||
}
|
||||
|
||||
signals:
|
||||
void numLegsChanged();
|
||||
|
||||
private:
|
||||
flightgear::FlightPlanRef _fp;
|
||||
};
|
||||
|
|
|
@ -322,6 +322,7 @@ Item {
|
|||
|
||||
Button {
|
||||
text: qsTr("View route")
|
||||
enabled: _launcher.flightPlan.legs.numLegs > 0
|
||||
onClicked: {
|
||||
detailLoader.airportGuid = 0
|
||||
detailLoader.sourceComponent = routeDetails;
|
||||
|
|
Loading…
Reference in a new issue