mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 03:35:35 +08:00
refs #212, removed set method as of MS review
https://dev.vatsim-germany.org/issues/212#note-6
This commit is contained in:
@@ -306,16 +306,6 @@ namespace BlackMisc
|
||||
this->m_value = json.value("value").toDouble();
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse from string
|
||||
*/
|
||||
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::parseFromString(const QString &value)
|
||||
{
|
||||
PQ parsed = CPqString::parse<PQ>(value);
|
||||
this->m_value = parsed.m_value;
|
||||
this->m_unit = parsed.m_unit;
|
||||
}
|
||||
|
||||
/*
|
||||
* metaTypeId
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "blackmisc/pqbase.h"
|
||||
#include "blackmisc/pqunits.h"
|
||||
#include "blackmisc/mathematics.h"
|
||||
#include "blackmisc/pqstring.h"
|
||||
#include <QtDBus/QDBusMetaType>
|
||||
#include <QtGlobal>
|
||||
#include <QString>
|
||||
@@ -51,6 +52,12 @@ namespace BlackMisc
|
||||
//! Copy constructor
|
||||
CPhysicalQuantity(const CPhysicalQuantity &other);
|
||||
|
||||
//! Constructor by parsed string, e.g. 10m
|
||||
CPhysicalQuantity(const QString &unitString) : m_value(0.0), m_unit(MU::nullUnit())
|
||||
{
|
||||
this->parseFromString(unitString);
|
||||
}
|
||||
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const override;
|
||||
|
||||
@@ -119,13 +126,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
//! Set by other PQ
|
||||
void set(const PQ &pq)
|
||||
{
|
||||
this->m_value = pq.m_value;
|
||||
this->m_unit = pq.m_unit;
|
||||
}
|
||||
|
||||
//! Rounded value in given unit
|
||||
double valueRounded(const MU &unit, int digits = -1) const;
|
||||
|
||||
@@ -235,7 +235,10 @@ namespace BlackMisc
|
||||
virtual void fromJson(const QJsonObject &json) override;
|
||||
|
||||
//! \copydoc CValueObject::parseFromString
|
||||
virtual void parseFromString(const QString &value) override;
|
||||
virtual void parseFromString(const QString &value) override
|
||||
{
|
||||
*this = CPqString::parse<PQ>(value);
|
||||
}
|
||||
|
||||
//! Register metadata of unit and quantity
|
||||
static void registerMetadata();
|
||||
|
||||
Reference in New Issue
Block a user