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
|
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;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue