21 const variant<QString, Unit>& unit,
const QString& persistentTag)
27 const variant<QString, Unit>& unit,
int decimals,
28 const RealLimits& limits,
const QString& persistentTag)
33 m_uid = QUuid::createUuid().toString(QUuid::WithoutBraces);
62 return !
m_uid.isEmpty();
67 if (QXmlStreamWriter* w = s.
xmlWriter()) {
73 }
else if (QXmlStreamReader* r = s.
xmlReader()) {
74 r->readNextStartElement();
Defines class DoubleProperty.
variant< QString, Unit > unit
Unit of the value (internal unit only!)
QString label
A label text (short, no trailing colon)
function< void(double)> set
function to set the value
RealLimits limits
Limits of the value.
function< double()> get
function to get the current value
QString tooltip
Tooltip text.
int decimals
numbers of decimals to be shown in an edit control
function< QString()> path
Path describing this value. Used e.g. for undo/redo.
Class for representing a double value, its attributes and its accessors.
void setTooltip(const QString &tooltip)
Set the tooltip.
void setLimits(const RealLimits &limits)
Set the limits.
DoubleDescriptor m_descriptor
descriptor, holding more attributes like label, tooltip etc.
QString m_uid
Unique id of this double property.
QString uid() const
Unique id of this double property.
QString persistentTag() const
Persistent tag for serializing.
unsigned m_decimals
Number of decimals to be shown in an edit field.
void setDecimals(unsigned decimals)
Set number of decimals to be shown in an edit field.
double m_value
Current value.
void setUnit(const variant< QString, Unit > &unit)
Set the unit.
unsigned decimals() const
Number of decimals to be shown in an edit field.
void set(double d)
Set the contained value.
double get() const
The contained value.
QString m_persistentTag
Persistent tag for serializing.
void init(const QString &label, const QString &tooltip, double value, const variant< QString, Unit > &unit, const QString &persistentTag)
bool isInitialized() const
True if one of the init methods has been called (checks for a valid uid).
void setUid(const QString &uid)
Set the unique id of this double property.
Supports serialization to or deserialization from QXmlStream.
void gotoEndElementOfTag(const QString &tag)
void assertCurrentTag(const QString &expectedTag) const
QXmlStreamWriter * xmlWriter()
Returns stream writer or nullptr.
QXmlStreamReader * xmlReader()
Returns stream reader or nullptr.
void writeAttribute(QXmlStreamWriter *writer, const QString &attributeName, const QVariant &variant)
Write the variant's value as an attribute.
void rwProperty(Streamer &s, DoubleProperty &d)