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

Description

Model to show items from FitParameterContainer in 5 column tree view.

Definition at line 26 of file FitParameterModel.h.

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

Public Types

enum  EColumn {
  COL_NAME , COL_TYPE , COL_VALUE , COL_MIN ,
  COL_MAX , NUM_COLUMNS
}
 

Public Member Functions

 FitParameterModel (FitParameterContainerItem *fitParContainer, QObject *parent=nullptr)
 
 ~FitParameterModel () override
 
bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override
 
int columnCount (const QModelIndex &parent) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
QModelIndex indexOfItem (SessionItem *item) const
 
bool isValidSourceItem (SessionItem *item) const
 Returns true if given item still exists in source model. More...
 
SessionItemitemForIndex (const QModelIndex &index) const
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 
QStringList mimeTypes () const override
 
QModelIndex parent (const QModelIndex &child) const override
 
int rowCount (const QModelIndex &parent) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 
SessionModelsourceModel () const
 
Qt::DropActions supportedDragActions () const override
 
Qt::DropActions supportedDropActions () const override
 

Private Slots

void onSourceAboutToBeReset ()
 
void onSourceDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
 
void onSourceRowsRemoved (const QModelIndex &parent, int first, int last)
 

Private Member Functions

void addColumn (EColumn id, const QString &name, const QString &tooltip)
 
void connectModel (QAbstractItemModel *sourceModel, bool isConnect=true) const
 

Private Attributes

QMap< int, QString > m_columnNames
 
QMap< int, QString > m_columnToolTips
 
FitParameterContainerItemm_parameterContainer
 

Member Enumeration Documentation

◆ EColumn

Enumerator
COL_NAME 
COL_TYPE 
COL_VALUE 
COL_MIN 
COL_MAX 
NUM_COLUMNS 

Definition at line 35 of file FitParameterModel.h.

Constructor & Destructor Documentation

◆ FitParameterModel()

FitParameterModel::FitParameterModel ( FitParameterContainerItem fitParContainer,
QObject *  parent = nullptr 
)
explicit

Definition at line 33 of file FitParameterModel.cpp.

34  : QAbstractItemModel(parent)
35  , m_parameterContainer(fitParContainer)
36 {
37  addColumn(COL_NAME, "Name", "Name of fit parameter");
38  addColumn(COL_TYPE, "Type", "Fit parameter limits type");
39  addColumn(COL_VALUE, "Value", "Starting value of fit parameter");
40  addColumn(COL_MIN, "Min", "Lower bound on fit parameter value");
41  addColumn(COL_MAX, "Max", "Upper bound on fit parameter value");
42 
43  connectModel(fitParContainer->model());
44 
46  [this](SessionItem* parentItem) {
47  if (parentItem != m_parameterContainer) {
48  throw Error("FitParameterModel::FitParameterModel() -> Error. "
49  "Wrong item reported.");
50  }
51  m_parameterContainer = nullptr;
52  },
53  this);
54 }
QModelIndex parent(const QModelIndex &child) const override
void addColumn(EColumn id, const QString &name, const QString &tooltip)
FitParameterContainerItem * m_parameterContainer
void connectModel(QAbstractItemModel *sourceModel, bool isConnect=true) const
void setOnItemDestroy(std::function< void(SessionItem *)> f, const void *caller=nullptr)
Definition: ModelMapper.cpp:67
Base class for a GUI data item.
Definition: SessionItem.h:204
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
SessionModel * model() const
Returns model of this item.
Definition: SessionItem.cpp:60

References addColumn(), COL_MAX, COL_MIN, COL_NAME, COL_TYPE, COL_VALUE, connectModel(), Error, m_parameterContainer, SessionItem::mapper(), SessionItem::model(), and ModelMapper::setOnItemDestroy().

Here is the call graph for this function:

◆ ~FitParameterModel()

FitParameterModel::~FitParameterModel ( )
override

Definition at line 56 of file FitParameterModel.cpp.

57 {
60 }
void unsubscribe(const void *caller)
Cancels all subscriptions of given caller.
Definition: ModelMapper.cpp:78

References m_parameterContainer, SessionItem::mapper(), and ModelMapper::unsubscribe().

Here is the call graph for this function:

Member Function Documentation

◆ addColumn()

void FitParameterModel::addColumn ( FitParameterModel::EColumn  id,
const QString &  name,
const QString &  tooltip 
)
private

Definition at line 364 of file FitParameterModel.cpp.

366 {
367  m_columnNames[id] = name;
368  m_columnToolTips[id] = tooltip;
369 }
QMap< int, QString > m_columnToolTips
QMap< int, QString > m_columnNames
QString const & name(EShape k)
Definition: particles.cpp:20

References m_columnNames, m_columnToolTips, and GUI::RealSpace::Particles::name().

Referenced by FitParameterModel().

Here is the call graph for this function:

◆ canDropMimeData()

bool FitParameterModel::canDropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
) const
override

Definition at line 264 of file FitParameterModel.cpp.

266 {
267  Q_UNUSED(data);
268  Q_UNUSED(action);
269  Q_UNUSED(row);
270  bool drop_is_possible(false);
271  if (parent.isValid())
272  drop_is_possible = true;
273  if (!parent.isValid() && row == -1 && column == -1)
274  drop_is_possible = true;
275  return drop_is_possible;
276 }
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override

References data(), and parent().

Here is the call graph for this function:

◆ columnCount()

int FitParameterModel::columnCount ( const QModelIndex &  parent) const
override

Definition at line 180 of file FitParameterModel.cpp.

181 {
183  return 0;
184 
185  if (parent.isValid() && parent.column() != COL_NAME)
186  return 0;
187 
188  if (!parent.isValid())
189  return NUM_COLUMNS;
190 
191  if (parent.isValid()) {
192  if (SessionItem* parentItem = itemForIndex(parent)) {
193  if (parentItem->hasModelType<FitParameterItem>())
194  return !polymorphic_downcast<FitParameterItem*>(parentItem)->linkItems().empty();
195  }
196  }
197  return 0;
198 }
FitParameterItems is a collection of items to define fit parameters in GUI.
SessionItem * itemForIndex(const QModelIndex &index) const

References COL_NAME, itemForIndex(), m_parameterContainer, NUM_COLUMNS, and parent().

Referenced by index().

Here is the call graph for this function:

◆ connectModel()

void FitParameterModel::connectModel ( QAbstractItemModel *  sourceModel,
bool  isConnect = true 
) const
private

Definition at line 344 of file FitParameterModel.cpp.

345 {
346  ASSERT(sourceModel);
347  if (isConnect) {
348  connect(sourceModel, &QAbstractItemModel::dataChanged, this,
350  connect(sourceModel, &QAbstractItemModel::rowsRemoved, this,
352  connect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, this,
354  } else {
355  disconnect(sourceModel, &QAbstractItemModel::dataChanged, this,
357  disconnect(sourceModel, &QAbstractItemModel::rowsRemoved, this,
359  disconnect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, this,
361  }
362 }
void onSourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
SessionModel * sourceModel() const
void onSourceRowsRemoved(const QModelIndex &parent, int first, int last)

References onSourceAboutToBeReset(), onSourceDataChanged(), onSourceRowsRemoved(), and sourceModel().

Referenced by FitParameterModel().

Here is the call graph for this function:

◆ data()

QVariant FitParameterModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

Definition at line 200 of file FitParameterModel.cpp.

201 {
203  return QVariant();
204 
205  if (!index.isValid() || index.column() < 0 || index.column() >= NUM_COLUMNS)
206  return QVariant();
207 
208  if (SessionItem* item = itemForIndex(index)) {
209  if (role == Qt::DisplayRole || role == Qt::EditRole) {
210  if (item->hasModelType<FitParameterItem>())
211  return item->displayName();
212  if (const auto* linkItem = dynamic_cast<FitParameterLinkItem*>(item->parentItem()))
213  return linkItem->title();
214  return item->value();
215  }
216  if (role == Qt::ForegroundRole && !item->isEditable())
217  return QVariant(QColor(Qt::gray));
218  if (role == Qt::ToolTipRole && item->hasModelType<FitParameterLinkItem>())
219  return item->value();
220  }
221  return QVariant();
222 }
The FitParameterLinkItem class holds a link to ParameterItem in tuning tree.
QModelIndex index(int row, int column, const QModelIndex &parent) const override

References index(), itemForIndex(), m_parameterContainer, and NUM_COLUMNS.

Referenced by canDropMimeData(), dropMimeData(), and mimeData().

Here is the call graph for this function:

◆ dropMimeData()

bool FitParameterModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
override

Definition at line 278 of file FitParameterModel.cpp.

280 {
281  Q_UNUSED(action);
282  Q_UNUSED(row);
283  Q_UNUSED(column);
284 
285  if (parent.isValid()) {
286  if (SessionItem* fitParItem = itemForIndex(parent)) {
287  ASSERT(fitParItem->hasModelType<FitParameterItem>());
288  ParameterItem* parItem = reinterpret_cast<ParameterItem*>(
289  data->data(GUI::Session::XML::LinkMimeType).toULongLong());
290  ASSERT(parItem);
291  m_parameterContainer->addToFitParameter(parItem, fitParItem->displayName());
292  }
293  } else {
294  ParameterItem* parItem = reinterpret_cast<ParameterItem*>(
295  data->data(GUI::Session::XML::LinkMimeType).toULongLong());
296  ASSERT(parItem);
298  }
299  return true;
300 }
void createFitParameter(ParameterItem *parameterItem)
Creates fit parameter from given ParameterItem, sets starting value to the value of ParameterItem,...
void addToFitParameter(ParameterItem *parameterItem, const QString &fitParName)
Adds given parameterItem to the existing fit parameter with display name fitParName....
The ParameterItem class represent a tuning value in a parameter tuning tree.
constexpr auto LinkMimeType
Definition: SessionXML.h:31

References FitParameterContainerItem::addToFitParameter(), FitParameterContainerItem::createFitParameter(), data(), itemForIndex(), GUI::Session::XML::LinkMimeType, m_parameterContainer, and parent().

Here is the call graph for this function:

◆ flags()

Qt::ItemFlags FitParameterModel::flags ( const QModelIndex &  index) const
override

Definition at line 62 of file FitParameterModel.cpp.

63 {
65  return Qt::NoItemFlags;
66 
67  Qt::ItemFlags result = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
68  if (SessionItem* item = itemForIndex(index)) {
69  if (item->isEditable() && index.column() != COL_NAME)
70  result |= Qt::ItemIsEditable;
71  if (item->parentItem()->hasModelType<FitParameterLinkItem>() && index.column() == COL_NAME)
72  result |= Qt::ItemIsDragEnabled;
73  const bool allow_one_fit_parameter_to_have_more_than_one_link = true;
74  if (allow_one_fit_parameter_to_have_more_than_one_link) {
75  // drop is allowed to fit parameter container, and, to FitParameterItem itself.
76  // (i.e. we can have more than one link in single FitParameterItem)
77  if (item->hasModelType<FitParameterItem>()
79  result |= Qt::ItemIsDropEnabled;
80  }
81  } else {
82  // drop is allowed only to fit parameter container
83  // (i.e. only one link is allowed in FitParameterItem)
84  if (item->hasModelType<FitParameterContainerItem>())
85  result |= Qt::ItemIsDropEnabled;
86  }
87  }
88  return result;
89 }
The FitParameterContainerItem class is a collection of all defined fit parameters in JobItem.
bool hasModelType() const
Definition: SessionItem.h:421

References COL_NAME, SessionItem::hasModelType(), index(), itemForIndex(), and m_parameterContainer.

Here is the call graph for this function:

◆ headerData()

QVariant FitParameterModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

Definition at line 302 of file FitParameterModel.cpp.

303 {
304  if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
305  return m_columnNames.value(section);
306  if (role == Qt::ToolTipRole)
307  return m_columnToolTips.value(section);
308  return QVariant();
309 }

References m_columnNames, and m_columnToolTips.

◆ index()

QModelIndex FitParameterModel::index ( int  row,
int  column,
const QModelIndex &  parent 
) const
override

Definition at line 91 of file FitParameterModel.cpp.

92 {
93  if (!m_parameterContainer || row < 0 || column < 0 || column >= columnCount(QModelIndex())
94  || (parent.isValid() && parent.column() != COL_NAME))
95  return QModelIndex();
96 
97  SessionItem* parent_item = itemForIndex(parent);
98  ASSERT(parent_item);
99 
100  if (parent_item->hasModelType<FitParameterContainerItem>()) {
101  QVector<FitParameterItem*> fitParamItems =
102  polymorphic_downcast<FitParameterContainerItem*>(parent_item)->fitParameterItems();
103  if (row < fitParamItems.size()) {
104  FitParameterItem* fitParItem = fitParamItems[row];
105  SessionItem* itemToPack = nullptr;
106  switch (column) {
107  case COL_NAME:
108  itemToPack = fitParItem;
109  break;
110  case COL_TYPE:
111  itemToPack = fitParItem->typeItem();
112  break;
113  case COL_VALUE:
114  itemToPack = fitParItem->startValueItem();
115  break;
116  case COL_MIN:
117  itemToPack = fitParItem->minimumItem();
118  break;
119  case COL_MAX:
120  itemToPack = fitParItem->maximumItem();
121  break;
122  default:
123  itemToPack = nullptr;
124  }
125  return createIndex(row, column, itemToPack);
126  }
127  } else if (parent_item->hasModelType<FitParameterItem>() && column == COL_NAME) {
128  QVector<FitParameterLinkItem*> links =
129  polymorphic_downcast<FitParameterItem*>(parent_item)->linkItems();
130  if (row < links.size()) {
131  if (FitParameterLinkItem* linkItem = links.at(row))
132  return createIndex(row, column, linkItem->linkItem());
133  }
134  }
135  return QModelIndex();
136 }
SessionItem * minimumItem() const
SessionItem * maximumItem() const
SessionItem * typeItem() const
SessionItem * startValueItem() const
int columnCount(const QModelIndex &parent) const override

References COL_MAX, COL_MIN, COL_NAME, COL_TYPE, COL_VALUE, columnCount(), SessionItem::hasModelType(), itemForIndex(), m_parameterContainer, FitParameterItem::maximumItem(), FitParameterItem::minimumItem(), parent(), FitParameterItem::startValueItem(), and FitParameterItem::typeItem().

Referenced by data(), flags(), indexOfItem(), itemForIndex(), mimeData(), setData(), and FitParameterWidget::spanParameters().

Here is the call graph for this function:

◆ indexOfItem()

QModelIndex FitParameterModel::indexOfItem ( SessionItem item) const

Definition at line 371 of file FitParameterModel.cpp.

372 {
374  return QModelIndex();
375 
376  if (SessionItem* parent_item = item->parentItem()) {
377  if (parent_item->hasModelType<FitParameterContainerItem>()) {
378  if (item->hasModelType<FitParameterItem>())
379  return createIndex(item->parentRow(), 0, item);
380  } else if (parent_item->hasModelType<FitParameterItem>()) {
381  auto* fitParam = polymorphic_downcast<FitParameterItem*>(parent_item);
382  std::optional<int> col;
383  if (item == fitParam->typeItem())
384  col = COL_TYPE;
385  else if (item == fitParam->startValueItem())
386  col = COL_VALUE;
387  else if (item == fitParam->minimumItem())
388  col = COL_MIN;
389  else if (item == fitParam->maximumItem())
390  col = COL_MAX;
391  if (col)
392  return createIndex(parent_item->parentRow(), col.value(), item);
393  } else if (parent_item->hasModelType<FitParameterLinkItem>()) {
394  QVector<FitParameterLinkItem*> links =
395  polymorphic_downcast<FitParameterItem*>(parent_item->parentItem())->linkItems();
396  int index = links.indexOf(polymorphic_downcast<FitParameterLinkItem*>(parent_item));
397  return createIndex(index, 0, item);
398  }
399  }
400  return QModelIndex();
401 }
SessionItem * parentItem() const
Returns parent of this item.
Definition: SessionItem.cpp:67
int parentRow()
Returns the index of the given item within its parent. Returns -1 when no parent is set.

References COL_MAX, COL_MIN, COL_TYPE, COL_VALUE, SessionItem::hasModelType(), index(), m_parameterContainer, SessionItem::parentItem(), and SessionItem::parentRow().

Referenced by onSourceDataChanged().

Here is the call graph for this function:

◆ isValidSourceItem()

bool FitParameterModel::isValidSourceItem ( SessionItem item) const

Returns true if given item still exists in source model.

Definition at line 426 of file FitParameterModel.cpp.

427 {
428  if (item == m_parameterContainer)
429  return true;
430  if (sourceModel()
432  return true;
433  return false;
434 }
QModelIndex index() const
Returns model index of this item.
Definition: SessionItem.cpp:74
bool isValidItem(SessionModel *model, SessionItem *item, const QModelIndex &parent)
Iterates through all the model and returns true if item is found. This is to.
Definition: ModelPath.cpp:20

References SessionItem::index(), GUI::Model::Path::isValidItem(), m_parameterContainer, and sourceModel().

Referenced by itemForIndex(), parent(), and rowCount().

Here is the call graph for this function:

◆ itemForIndex()

SessionItem * FitParameterModel::itemForIndex ( const QModelIndex &  index) const

Definition at line 403 of file FitParameterModel.cpp.

404 {
406  return nullptr;
407 
408  if (index.isValid()) {
409  auto* item = static_cast<SessionItem*>(index.internalPointer());
410  if (item) {
411  if (!isValidSourceItem(item))
412  return nullptr;
413  return item;
414  }
415  }
416  return m_parameterContainer;
417 }
bool isValidSourceItem(SessionItem *item) const
Returns true if given item still exists in source model.

References index(), isValidSourceItem(), and m_parameterContainer.

Referenced by columnCount(), data(), dropMimeData(), flags(), index(), mimeData(), FitParameterWidget::onFitParametersSelectionChanged(), parent(), rowCount(), FitParameterWidget::selectedFitParameterLinks(), FitParameterWidget::selectedFitParameters(), and setData().

Here is the call graph for this function:

◆ mimeData()

QMimeData * FitParameterModel::mimeData ( const QModelIndexList &  indexes) const
override

Definition at line 248 of file FitParameterModel.cpp.

249 {
250  auto* mimeData = new QMimeData();
251  QModelIndex index = indexes.first();
252  if (index.isValid()) {
253  if (SessionItem* item = itemForIndex(index)) {
254  QString path = item->value().toString();
255  auto* parameterItem = FitParameterHelper::getParameterItem(m_parameterContainer, path);
256  QByteArray data;
257  data.setNum(reinterpret_cast<qlonglong>(parameterItem));
259  }
260  }
261  return mimeData;
262 }
QMimeData * mimeData(const QModelIndexList &indexes) const override
ParameterItem * getParameterItem(FitParameterContainerItem *container, const QString &link)
Returns ParameterItem corresponding to given link.

References data(), FitParameterHelper::getParameterItem(), index(), itemForIndex(), GUI::Session::XML::LinkMimeType, and m_parameterContainer.

Here is the call graph for this function:

◆ mimeTypes()

QStringList FitParameterModel::mimeTypes ( ) const
override

Definition at line 241 of file FitParameterModel.cpp.

242 {
243  QStringList types;
245  return types;
246 }

References GUI::Session::XML::LinkMimeType.

◆ onSourceAboutToBeReset

void FitParameterModel::onSourceAboutToBeReset ( )
privateslot

Definition at line 336 of file FitParameterModel.cpp.

337 {
339  return;
340  beginResetModel();
341  endResetModel();
342 }

References m_parameterContainer.

Referenced by connectModel().

◆ onSourceDataChanged

void FitParameterModel::onSourceDataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight,
const QVector< int > &  roles 
)
privateslot

Definition at line 311 of file FitParameterModel.cpp.

314 {
315  Q_UNUSED(bottomRight);
316 
317  auto* sourceModel = qobject_cast<JobModel*>(sender());
318  ASSERT(sourceModel);
319  SessionItem* sourceItem = sourceModel->itemForIndex(topLeft);
320 
321  QModelIndex itemIndex = indexOfItem(sourceItem);
322 
323  if (itemIndex.isValid())
324  emit dataChanged(itemIndex, itemIndex, roles);
325 }
QModelIndex indexOfItem(SessionItem *item) const
SessionItem * itemForIndex(const QModelIndex &index) const

References indexOfItem(), SessionModel::itemForIndex(), and sourceModel().

Referenced by connectModel().

Here is the call graph for this function:

◆ onSourceRowsRemoved

void FitParameterModel::onSourceRowsRemoved ( const QModelIndex &  parent,
int  first,
int  last 
)
privateslot

Definition at line 327 of file FitParameterModel.cpp.

328 {
329  Q_UNUSED(parent);
330  Q_UNUSED(first);
331  Q_UNUSED(last);
332  beginResetModel();
333  endResetModel();
334 }

References parent().

Referenced by connectModel().

Here is the call graph for this function:

◆ parent()

QModelIndex FitParameterModel::parent ( const QModelIndex &  child) const
override

Definition at line 138 of file FitParameterModel.cpp.

139 {
141  return QModelIndex();
142 
143  if (!child.isValid())
144  return QModelIndex();
145 
146  if (SessionItem* child_item = itemForIndex(child)) {
147  if (SessionItem* parent_item = child_item->parentItem()) {
148  if (!isValidSourceItem(parent_item))
149  return QModelIndex();
150  if (parent_item->hasModelType<FitParameterLinkItem>()) {
151  SessionItem* fitPar = parent_item->parentItem();
152  if (!isValidSourceItem(fitPar))
153  return QModelIndex();
154  return createIndex(fitPar->parentRow(), 0, fitPar);
155  }
156  }
157  }
158  return QModelIndex();
159 }

References isValidSourceItem(), itemForIndex(), m_parameterContainer, SessionItem::parentItem(), and SessionItem::parentRow().

Referenced by canDropMimeData(), columnCount(), dropMimeData(), index(), onSourceRowsRemoved(), and rowCount().

Here is the call graph for this function:

◆ rowCount()

int FitParameterModel::rowCount ( const QModelIndex &  parent) const
override

Definition at line 161 of file FitParameterModel.cpp.

162 {
164  return 0;
165 
166  if (parent.isValid() && parent.column() != COL_NAME)
167  return 0;
168 
169  SessionItem* parent_item = itemForIndex(parent);
170  if (parent_item != m_parameterContainer && !isValidSourceItem(parent_item))
171  return 0;
172 
173  if (parent_item->hasModelType<FitParameterContainerItem>())
174  return parent_item->numberOfChildren();
175  if (parent_item->hasModelType<FitParameterItem>())
176  return polymorphic_downcast<FitParameterItem*>(parent_item)->linkItems().size();
177  return 0;
178 }
int numberOfChildren() const
Returns total number of children.
Definition: SessionItem.cpp:88

References COL_NAME, SessionItem::hasModelType(), isValidSourceItem(), itemForIndex(), m_parameterContainer, SessionItem::numberOfChildren(), and parent().

Referenced by FitParameterWidget::spanParameters().

Here is the call graph for this function:

◆ setData()

bool FitParameterModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
override

Definition at line 224 of file FitParameterModel.cpp.

225 {
227  return false;
228 
229  if (!index.isValid())
230  return false;
231  if (SessionItem* item = itemForIndex(index)) {
232  if (role == Qt::EditRole) {
233  item->setValue(value);
234  emit dataChanged(index, index);
235  return true;
236  }
237  }
238  return false;
239 }

References index(), itemForIndex(), and m_parameterContainer.

Here is the call graph for this function:

◆ sourceModel()

SessionModel * FitParameterModel::sourceModel ( ) const

Definition at line 419 of file FitParameterModel.cpp.

420 {
421  ASSERT(m_parameterContainer);
422  return m_parameterContainer->model();
423 }

References m_parameterContainer, and SessionItem::model().

Referenced by connectModel(), isValidSourceItem(), and onSourceDataChanged().

Here is the call graph for this function:

◆ supportedDragActions()

Qt::DropActions FitParameterModel::supportedDragActions ( ) const
inlineoverride

Definition at line 78 of file FitParameterModel.h.

79 {
80  return Qt::MoveAction | Qt::CopyAction;
81 }

◆ supportedDropActions()

Qt::DropActions FitParameterModel::supportedDropActions ( ) const
inlineoverride

Definition at line 83 of file FitParameterModel.h.

84 {
85  return Qt::MoveAction | Qt::CopyAction;
86 }

Member Data Documentation

◆ m_columnNames

QMap<int, QString> FitParameterModel::m_columnNames
private

Definition at line 74 of file FitParameterModel.h.

Referenced by addColumn(), and headerData().

◆ m_columnToolTips

QMap<int, QString> FitParameterModel::m_columnToolTips
private

Definition at line 75 of file FitParameterModel.h.

Referenced by addColumn(), and headerData().

◆ m_parameterContainer


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