Fixed by ignoring all other property indexes
This commit is contained in:
Klaus Basan
2017-12-18 20:56:58 +01:00
parent 6701266a66
commit fd4c7c09f6

View File

@@ -172,20 +172,14 @@ namespace BlackGui
void CMappingComponent::ps_onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
{
if (!sGui || !index.contains(CSimulatedAircraft::IndexEnabled)) { return; } // we only deal with enabled/disabled here
const CSimulatedAircraft sa = object.to<CSimulatedAircraft>(); // changed in GUI
const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign());
if (!saFromBackend.hasValidCallsign()) { return; } // obviously deleted
if (index.contains(CSimulatedAircraft::IndexEnabled))
{
const bool enabled = sa.propertyByIndex(index).toBool();
if (saFromBackend.isEnabled() == enabled) { return; }
CLogMessage(this).info("Request to %1 aircraft %2") << (enabled ? "enable" : "disable") << saFromBackend.getCallsign().toQString();
sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), enabled);
}
else
{
Q_ASSERT_X(false, "ps_onChangedSimulatedAircraftInView", "Index not supported");
}
const bool nowEnabled = sa.isEnabled();
if (saFromBackend.isEnabled() == nowEnabled) { return; } // already same value
CLogMessage(this).info("Request to %1 aircraft %2") << (nowEnabled ? "enable" : "disable") << saFromBackend.getCallsign().toQString();
sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), nowEnabled);
}
void CMappingComponent::ps_onAircraftSelectedInView(const QModelIndex &index)