mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #319, added column formatters
* Specialized formatters (e.g. for bool, for PQs etc.) allow specialized look and feel for each column * Fixed isValidComFrequency used for formatters * Changed models to use formatters * Outdated propertyByIndexAsString methods removed * During the above tasks: fixed override keyword in some places * Column tooltips * refs #323, wrong column name fix
This commit is contained in:
@@ -351,10 +351,7 @@ namespace BlackMisc
|
||||
case IndexVoiceRoom:
|
||||
return QVariant(this->m_voiceRoom.propertyByIndex(index.copyFrontRemoved()));
|
||||
default:
|
||||
if (ICoordinateGeodetic::canHandleIndex(index))
|
||||
{
|
||||
return ICoordinateGeodetic::propertyByIndex(index);
|
||||
}
|
||||
if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::propertyByIndex(index); }
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
@@ -424,49 +421,8 @@ namespace BlackMisc
|
||||
bool CAtcStation::isA(int metaTypeId) const
|
||||
{
|
||||
if (metaTypeId == qMetaTypeId<CAtcStation>()) { return true; }
|
||||
|
||||
return this->CValueObject::isA(metaTypeId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Property as string by index
|
||||
*/
|
||||
QString CAtcStation::propertyByIndexAsString(const BlackMisc::CPropertyIndex &index, bool i18n) const
|
||||
{
|
||||
QVariant qv = this->propertyByIndex(index);
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
|
||||
// special treatment
|
||||
// this is required as it is possible an ATC station is not containing all
|
||||
// properties
|
||||
switch (i)
|
||||
{
|
||||
case IndexFrequency:
|
||||
if (!CComSystem::isValidCivilAviationFrequency(qv.value<CFrequency>()))
|
||||
return "";
|
||||
else
|
||||
return qv.value<CFrequency>().valueRoundedWithUnit(3, i18n);
|
||||
break;
|
||||
case IndexDistance:
|
||||
{
|
||||
CLength distance = qv.value<CLength>();
|
||||
if (distance.isNegativeWithEpsilonConsidered()) return "";
|
||||
return distance.toQString(i18n);
|
||||
}
|
||||
|
||||
case IndexBookedFrom:
|
||||
case IndexBookedUntil:
|
||||
{
|
||||
QDateTime dt = qv.value<QDateTime>();
|
||||
if (dt.isNull() || !dt.isValid()) return "";
|
||||
return dt.toString("yyyy-MM-dd HH:mm");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return BlackMisc::qVariantToString(qv, i18n);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user