Refactoring.
Method void QMap::insert(const QMap<Key, T> &map) available since Qt 5.15.
This commit is contained in:
parent
376152da8c
commit
a547822af1
|
@ -286,4 +286,20 @@ inline auto TextWidthF(const QFontMetricsF &fm, const QString &text) -> qreal
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename Key, typename T>
|
||||||
|
inline auto Insert(QMap<Key, T> &map1, const QMap<Key, T> &map2) -> void
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
map1.insert(map2);
|
||||||
|
#else
|
||||||
|
auto i = map2.constBegin();
|
||||||
|
while (i != map2.constEnd())
|
||||||
|
{
|
||||||
|
map1.insert(i.key(), i.value());
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif // COMPATIBILITY_H
|
#endif // COMPATIBILITY_H
|
||||||
|
|
|
@ -597,12 +597,7 @@ const QMap<QString, QSharedPointer<VMeasurement> > VContainer::DataMeasurementsW
|
||||||
QMap<QString, QSharedPointer<VMeasurement> > measurements = DataVar<VMeasurement>(VarType::Measurement);
|
QMap<QString, QSharedPointer<VMeasurement> > measurements = DataVar<VMeasurement>(VarType::Measurement);
|
||||||
QMap<QString, QSharedPointer<VMeasurement> > separators = DataVar<VMeasurement>(VarType::MeasurementSeparator);
|
QMap<QString, QSharedPointer<VMeasurement> > separators = DataVar<VMeasurement>(VarType::MeasurementSeparator);
|
||||||
|
|
||||||
QMap<QString, QSharedPointer<VMeasurement>>::const_iterator i = separators.constBegin();
|
Insert(measurements, separators);
|
||||||
while (i != separators.constEnd())
|
|
||||||
{
|
|
||||||
measurements.insert(i.key(), i.value());
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return measurements;
|
return measurements;
|
||||||
}
|
}
|
||||||
|
@ -619,12 +614,7 @@ const QMap<QString, QSharedPointer<VIncrement> > VContainer::DataIncrementsWithS
|
||||||
QMap<QString, QSharedPointer<VIncrement> > increments = DataVar<VIncrement>(VarType::Increment);
|
QMap<QString, QSharedPointer<VIncrement> > increments = DataVar<VIncrement>(VarType::Increment);
|
||||||
QMap<QString, QSharedPointer<VIncrement> > separators = DataVar<VIncrement>(VarType::IncrementSeparator);
|
QMap<QString, QSharedPointer<VIncrement> > separators = DataVar<VIncrement>(VarType::IncrementSeparator);
|
||||||
|
|
||||||
QMap<QString, QSharedPointer<VIncrement>>::const_iterator i = separators.constBegin();
|
Insert(increments, separators);
|
||||||
while (i != separators.constEnd())
|
|
||||||
{
|
|
||||||
increments.insert(i.key(), i.value());
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return increments;
|
return increments;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user