23 #include <QXmlStreamReader>
24 #include <QXmlStreamWriter>
30 const QString BackupValues(
"BackupValues");
31 const QString BackupValue(
"BackupValue");
32 const QString Link(
"Link");
33 const QString
Value(
"Value");
37 ParameterItem* findParameterItem(QObject* item,
const QString& link)
41 if (parameter->link() == link)
44 for (
auto* child : item->children())
45 if (
auto* p = findParameterItem(child, link))
139 result.push_front(pLabel->title() +
"/");
157 writer->writeStartElement(Tags::BackupValues);
160 writer->writeEmptyElement(Tags::BackupValue);
164 writer->writeEndElement();
178 while (reader->readNextStartElement()) {
179 if (reader->name().toString() == Tags::BackupValues) {
180 while (reader->readNextStartElement()) {
181 ASSERT(reader->name().toString() == Tags::BackupValue);
187 reader->skipCurrentElement();
203 parameter->propagateValueToLink(
m_backupValues[parameter->link()]);
205 for (
auto* child : item->children())
Defines class DeserializationException.
Defines class MaterialItem.
Defines class MaterialItems.
Defines classes for ParameterTreeItems.
Defines class Helpers functions.
Defines class VectorDescriptor.
static DeserializationException tooOld()
static DeserializationException tooNew()
Describes properties of a double value which are necessary to allow GUI representation,...
function< void(double)> set
function to set the value
RealLimits limits
Limits of the value.
function< double()> get
function to get the current value
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.
QObject * parameterTreeRoot()
void setBackupValue(const QString &link, double d)
ParameterItem * findParameterItem(const QString &link) const
std::unique_ptr< QObject > m_parameterTreeRoot
void restoreBackupValues()
QMap< QString, double > m_backupValues
void restoreBackupValue(QObject *item)
void readContentFrom(QXmlStreamReader *reader)
void writeContentTo(QXmlStreamWriter *writer) const
The ParameterItem class represent a tuning value in a parameter tuning tree.
QString titleForFitItem() const
void linkToSessionItem(SessionItem *item)
Links this item to the given session item.
double valueOfLink() const
void propagateValueToLink(double newValue)
Sets current value to the original PropertyItem of MultiLayerItem/InstrumentItem.
QString m_link
See docu of link()
int decimalsOfLink() const
ParameterItem(QObject *parent)
QString link() const
Unique string to identify this ParameterItem.
RealLimits limitsOfLink() const
void setTitle(const QString &title)
void linkToDescriptor(DoubleDescriptor d)
Links this item to the given value defined by a descriptor.
DoubleDescriptor m_d
The linked double value.
ParameterTreeItems is a collection of items necessary to form a tuning tree for real time widget.
ParameterLabelItem(QObject *parent)
void setTitle(const QString &title)
Base class for a GUI data item.
QModelIndex index() const
Returns model index of this item.
void readAttribute(QXmlStreamReader *reader, const QString &attributeName, double *d)
constexpr auto Version("Version")
void writeAttribute(QXmlStreamWriter *writer, const QString &attributeName, const QVariant &variant)
Write the variant's value as an attribute.
QString getPathFromIndex(const QModelIndex &index)