BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ParameterItem Class Reference

Description

The ParameterItem class represent a tuning value in a parameter tuning tree.

Definition at line 42 of file ParameterTreeItems.h.

Inheritance diagram for ParameterItem:
[legend]
Collaboration diagram for ParameterItem:
[legend]

Public Member Functions

 ParameterItem (QObject *parent)
 
int decimalsOfLink () const
 
RealLimits limitsOfLink () const
 
QString link () const
 Unique string to identify this ParameterItem. More...
 
void linkToDescriptor (DoubleDescriptor d)
 Links this item to the given value defined by a descriptor. More...
 
void linkToSessionItem (SessionItem *item)
 Links this item to the given session item. More...
 
void propagateValueToLink (double newValue)
 Sets current value to the original PropertyItem of MultiLayerItem/InstrumentItem. More...
 
void setTitle (const QString &title)
 
QString title () const
 
QString titleForFitItem () const
 
double valueOfLink () const
 

Private Attributes

DoubleDescriptor m_d
 The linked double value. More...
 
QString m_link
 See docu of link() More...
 
QString m_title
 

Constructor & Destructor Documentation

◆ ParameterItem()

ParameterItem::ParameterItem ( QObject *  parent)

Definition at line 75 of file ParameterTreeItems.cpp.

76  : QObject(parent)
77 {
78 }

Member Function Documentation

◆ decimalsOfLink()

int ParameterItem::decimalsOfLink ( ) const

Definition at line 122 of file ParameterTreeItems.cpp.

123 {
124  return m_d.decimals;
125 }
int decimals
numbers of decimals to be shown in an edit control
DoubleDescriptor m_d
The linked double value.

References DoubleDescriptor::decimals, and m_d.

Referenced by ParameterTuningDelegate::createEditor().

◆ limitsOfLink()

RealLimits ParameterItem::limitsOfLink ( ) const

Definition at line 117 of file ParameterTreeItems.cpp.

118 {
119  return m_d.limits;
120 }
RealLimits limits
Limits of the value.

References DoubleDescriptor::limits, and m_d.

Referenced by ParameterTuningDelegate::createEditor(), and FitParameterContainerItem::createFitParameter().

◆ link()

QString ParameterItem::link ( ) const

Unique string to identify this ParameterItem.

The link is arbitrary. It can't be used for finding the linked item (therefore it does not have to be a model path). However, it is used for comparison, also across project load/save. Therefore the link is always the same, not e.g. an always generated UUID. This link is used for setting backup values and for finding this ParameterItem when referring from fit parameters.

Definition at line 127 of file ParameterTreeItems.cpp.

128 {
129  return m_link;
130 }
QString m_link
See docu of link()

References m_link.

Referenced by FitParameterContainerItem::addToFitParameter(), FitParameterContainerItem::createFitParameter(), FitParameterContainerItem::fitParameterItem(), and FitParameterContainerItem::removeLink().

◆ linkToDescriptor()

void ParameterItem::linkToDescriptor ( DoubleDescriptor  d)

Links this item to the given value defined by a descriptor.

Definition at line 105 of file ParameterTreeItems.cpp.

106 {
107  m_link = d.path();
108  m_d = d;
109 }
function< QString()> path
Path describing this value. Used e.g. for undo/redo.

References m_d, m_link, and DoubleDescriptor::path.

◆ linkToSessionItem()

void ParameterItem::linkToSessionItem ( SessionItem item)

Links this item to the given session item.

Definition at line 111 of file ParameterTreeItems.cpp.

112 {
114  m_d = DoubleDescriptor(item, "");
115 }
Describes properties of a double value which are necessary to allow GUI representation,...
QModelIndex index() const
Returns model index of this item.
Definition: SessionItem.cpp:74
QString getPathFromIndex(const QModelIndex &index)
Definition: Path.cpp:144

References GUI::Util::Path::getPathFromIndex(), SessionItem::index(), m_d, and m_link.

Here is the call graph for this function:

◆ propagateValueToLink()

void ParameterItem::propagateValueToLink ( double  newValue)

Sets current value to the original PropertyItem of MultiLayerItem/InstrumentItem.

Definition at line 100 of file ParameterTreeItems.cpp.

101 {
102  m_d.set(newValue);
103 }
function< void(double)> set
function to set the value

References m_d, and DoubleDescriptor::set.

Referenced by ParameterTuningDelegate::emitSignals().

◆ setTitle()

void ParameterItem::setTitle ( const QString &  title)

Definition at line 88 of file ParameterTreeItems.cpp.

89 {
90  m_title = title;
91 }
QString title() const

References m_title, and title().

Here is the call graph for this function:

◆ title()

QString ParameterItem::title ( ) const

Definition at line 83 of file ParameterTreeItems.cpp.

84 {
85  return m_title;
86 }

References m_title.

Referenced by setTitle().

◆ titleForFitItem()

QString ParameterItem::titleForFitItem ( ) const

Definition at line 132 of file ParameterTreeItems.cpp.

133 {
134  QString result = m_title;
135 
136  auto* p = parent();
137  while (p) {
138  if (const auto* pLabel = dynamic_cast<ParameterLabelItem*>(p))
139  result.push_front(pLabel->title() + "/");
140  p = p->parent();
141  }
142 
143  return result;
144 }
ParameterTreeItems is a collection of items necessary to form a tuning tree for real time widget.

References m_title.

Referenced by FitParameterContainerItem::addToFitParameter(), and FitParameterContainerItem::createFitParameter().

◆ valueOfLink()

double ParameterItem::valueOfLink ( ) const

Definition at line 93 of file ParameterTreeItems.cpp.

94 {
95  return m_d.get();
96 }
function< double()> get
function to get the current value

References DoubleDescriptor::get, and m_d.

Referenced by FitParameterContainerItem::createFitParameter().

Member Data Documentation

◆ m_d

DoubleDescriptor ParameterItem::m_d
private

The linked double value.

Definition at line 75 of file ParameterTreeItems.h.

Referenced by decimalsOfLink(), limitsOfLink(), linkToDescriptor(), linkToSessionItem(), propagateValueToLink(), and valueOfLink().

◆ m_link

QString ParameterItem::m_link
private

See docu of link()

Definition at line 74 of file ParameterTreeItems.h.

Referenced by link(), linkToDescriptor(), and linkToSessionItem().

◆ m_title

QString ParameterItem::m_title
private

Definition at line 73 of file ParameterTreeItems.h.

Referenced by setTitle(), title(), and titleForFitItem().


The documentation for this class was generated from the following files: