Skip to content
Snippets Groups Projects
Commit c981fa3a authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rm call of unitAsString

parent 7077abe6
No related branches found
No related tags found
1 merge request!2003In GUI, remove option to switch beteen nm and angstrom, degrees and radians.
...@@ -37,17 +37,6 @@ using std::variant; ...@@ -37,17 +37,6 @@ using std::variant;
namespace { namespace {
QString labelWithUnit(const QString& label, variant<QString, Unit> unit)
{
const QString s = std::holds_alternative<QString>(unit) ? std::get<QString>(unit)
: unitAsString(std::get<Unit>(unit));
if (!s.isEmpty())
return label + " (" + s + ")";
return label;
}
template <typename Catalog> template <typename Catalog>
ParameterLabelItem* addLabel(ParameterLabelItem* parent, const QString& category, ParameterLabelItem* addLabel(ParameterLabelItem* parent, const QString& category,
const typename Catalog::CatalogedType* p) const typename Catalog::CatalogedType* p)
...@@ -138,10 +127,10 @@ void ParameterTreeBuilder::addSample() ...@@ -138,10 +127,10 @@ void ParameterTreeBuilder::addSample()
} }
void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, DoubleProperty& d, void ParameterTreeBuilder::addParameterItem(ParameterLabelItem* parent, DoubleProperty& d,
const QString& label) const QString& label)
{ {
auto* parameterItem = new ParameterItem(parent); auto* parameterItem = new ParameterItem(parent);
parameterItem->setTitle(labelWithUnit(label.isEmpty() ? d.label() : label, d.unit())); parameterItem->setTitle(label.isEmpty() ? d.label() : label);
parameterItem->linkToProperty(d); parameterItem->linkToProperty(d);
if (m_recreateBackupValues) if (m_recreateBackupValues)
m_jobItem->parameterContainerItem()->setBackupValue(parameterItem->link(), d.value()); m_jobItem->parameterContainerItem()->setBackupValue(parameterItem->link(), d.value());
...@@ -411,8 +400,7 @@ void ParameterTreeBuilder::addBackground(ParameterLabelItem* instrumentLabel, ...@@ -411,8 +400,7 @@ void ParameterTreeBuilder::addBackground(ParameterLabelItem* instrumentLabel,
BackgroundItem* backgroundItem) BackgroundItem* backgroundItem)
{ {
if (auto* b = dynamic_cast<ConstantBackgroundItem*>(backgroundItem)) if (auto* b = dynamic_cast<ConstantBackgroundItem*>(backgroundItem))
addParameterItem(instrumentLabel, b->backgroundValue(), addParameterItem(instrumentLabel, b->backgroundValue());
labelWithUnit("Constant background", b->backgroundValue().unit()));
} }
void ParameterTreeBuilder::addPolarization(ParameterLabelItem* instrumentLabel, void ParameterTreeBuilder::addPolarization(ParameterLabelItem* instrumentLabel,
......
...@@ -54,7 +54,7 @@ private: ...@@ -54,7 +54,7 @@ private:
void addSample(); void addSample();
void addInstrument(); void addInstrument();
void addParameterItem(ParameterLabelItem* parent, DoubleProperty& d, void addParameterItem(ParameterLabelItem* parent, DoubleProperty& d,
const QString& label = QString()); const QString& label = "");
void addParameterItem(ParameterLabelItem* parent, VectorProperty& d); void addParameterItem(ParameterLabelItem* parent, VectorProperty& d);
void addMagnetizationNoZ(ParameterLabelItem* parent, VectorProperty& d); void addMagnetizationNoZ(ParameterLabelItem* parent, VectorProperty& d);
ParameterContainerItem* parameterContainerItem(); ParameterContainerItem* parameterContainerItem();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment