Skip to content
Snippets Groups Projects
Commit e27f43cb authored by Matthias Puchner's avatar Matthias Puchner
Browse files

do not expose SessionItem as linked item

parent c03f109a
No related branches found
No related tags found
1 merge request!494Remove SessionModel/SessionItem from MaterialModel/MaterialItem
......@@ -13,8 +13,8 @@
// ************************************************************************************************
#include "GUI/Model/Fit/FitParameterHelper.h"
#include "GUI/Model/Fit/FitParameterItem.h"
#include "GUI/Model/Fit/FitParameterContainerItem.h"
#include "GUI/Model/Fit/FitParameterItem.h"
#include "GUI/Model/Fit/FitParameterLinkItem.h"
#include "GUI/Model/Fit/ParameterTreeItems.h"
#include "GUI/Model/Job/JobItem.h"
......@@ -39,7 +39,7 @@ void FitParameterHelper::createFitParameter(FitParameterContainerItem* container
fitPar->setStartValue(parameterItem->value().toDouble());
link->setLink(getParameterItemPath(parameterItem));
fitPar->initMinMaxValues(parameterItem->linkedItem()->limits());
fitPar->initMinMaxValues(parameterItem->limitsOfLink());
}
//! Removes link to given parameterItem from fit parameters
......
......@@ -56,7 +56,7 @@ void ParameterItem::propagateValueToLink(double newValue)
//! Returns corresponding linked item in MultiLayerItem/InstrumentItem
SessionItem* ParameterItem::linkedItem()
SessionItem* ParameterItem::linkedItem() const
{
const SessionItem* jobItem = GUI::Model::Path::ancestor(this, JobItem::M_TYPE);
ASSERT(jobItem);
......@@ -69,6 +69,16 @@ void ParameterItem::setLink(const QString& link)
m_link = link;
}
RealLimits ParameterItem::limitsOfLink() const
{
return linkedItem()->limits();
}
int ParameterItem::decimalsOfLink() const
{
return linkedItem()->decimals();
}
QString ParameterItem::link() const
{
return m_link;
......
......@@ -39,11 +39,14 @@ public:
ParameterItem();
void propagateValueToLink(double newValue);
SessionItem* linkedItem();
void setLink(const QString& link);
QString link() const;
RealLimits limitsOfLink() const;
int decimalsOfLink() const;
private:
SessionItem* linkedItem() const;
QString m_link; //!< Link to original PropertyItem
};
......
......@@ -147,7 +147,7 @@ QWidget* ParameterTuningDelegate::createEditor(QWidget* parent, const QStyleOpti
return nullptr;
double value = data.toDouble();
RealLimits limits = m_currentItem->linkedItem()->limits();
RealLimits limits = m_currentItem->limitsOfLink();
m_tuning_info.setItemLimits(limits);
m_tuning_info.value_to_slider(value);
......@@ -155,7 +155,7 @@ QWidget* ParameterTuningDelegate::createEditor(QWidget* parent, const QStyleOpti
m_valueBox = new ScientificSpinBox();
m_valueBox->setKeyboardTracking(false);
m_valueBox->setFixedWidth(105);
m_valueBox->setDecimals(m_currentItem->linkedItem()->decimals());
m_valueBox->setDecimals(m_currentItem->decimalsOfLink());
m_valueBox->setSingleStep(m_tuning_info.step());
if (limits.hasLowerLimit()) {
......
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