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

Description

The FitParametersWidget class contains a tree view to set fit parameters (fix/release, starting value, min/max bounds). It occupies bottom right corner of JobView.

Definition at line 37 of file FitParameterWidget.h.

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

Public Slots

void onFitParametersSelectionChanged (const QItemSelection &selection)
 Propagates selection form the tree with fit parameters to the tuning widget. More...
 
void onFitParameterTreeContextMenu (const QPoint &point)
 Creates context menu for the tree with fit parameters. More...
 
void onTuningWidgetContextMenu (const QPoint &point)
 Creates context menu for ParameterTuningWidget. More...
 

Public Member Functions

 FitParameterWidget (QWidget *parent=nullptr)
 
virtual QList< QAction * > actionList ()
 
SessionItemcurrentItem ()
 
const SessionItemcurrentItem () const
 
virtual void setItem (SessionItem *item)
 
void setParameterTuningWidget (ParameterTuningWidget *tuningWidget)
 Sets ParameterTuningWidget to be able to provide it with context menu and steer its behaviour in the course of fit settings or fit running. More...
 

Protected Member Functions

void hideEvent (QHideEvent *) override
 
void showEvent (QShowEvent *) override
 
void subscribeToItem () override
 
virtual void unsubscribeFromItem ()
 

Private Slots

void onAddToFitParAction (int ipar)
 Add all selected parameters to fitParameter with given index. More...
 
void onCreateFitParAction ()
 Creates fit parameters for all selected ParameterItem's in tuning widget. More...
 
void onFitParameterModelChange ()
 
void onRemoveFitParAction ()
 All selected FitParameterItem's of FitParameterItemLink's will be removed. More...
 
void onRemoveFromFitParAction ()
 All ParameterItem's selected in tuning widget will be removed from link section of corresponding fitParameterItem. More...
 

Private Member Functions

bool canCreateFitParameter ()
 Returns true if tuning widget contains selected ParameterItem's which can be used to create a fit parameter (i.e. it is not linked with some fit parameter already). More...
 
bool canRemoveFromFitParameters ()
 Returns true if tuning widget contains selected ParameterItem's which can be removed from fit parameters. More...
 
void connectFitParametersSelection (bool active)
 
QVector< FitParameterItem * > emptyFitParameters ()
 Returns list of FitParameterItem's which doesn't have any links attached. More...
 
void init_actions ()
 
void init_fit_model ()
 Initializes FitParameterModel and its tree. More...
 
JobItemjobItem ()
 
QStringList selectedFitParameterLinks ()
 Returns links of FitParameterLink's item selected in FitParameterItem tree. More...
 
QVector< FitParameterItem * > selectedFitParameters ()
 Returns list of FitParameterItem's currently selected in FitParameterItem tree. More...
 
void setActionsEnabled (bool value)
 Enables/disables all context menu actions. More...
 
void spanParameters ()
 Makes first column in FitParameterItem's tree related to ParameterItem link occupy whole space. More...
 
void updateInfoLabel ()
 Places overlay label on top of tree view, if there is no fit parameters. More...
 

Private Attributes

QAction * m_createFitParAction
 
FitParameterModelm_fitParameterModel
 
OverlayLabelControllerm_infoLabel
 
SessionItemControllerm_itemController
 
DeleteEventFilterm_keyboardFilter
 
QAction * m_removeFitParAction
 
QAction * m_removeFromFitParAction
 
QTreeView * m_treeView
 
ParameterTuningWidgetm_tuningWidget
 

Constructor & Destructor Documentation

◆ FitParameterWidget()

FitParameterWidget::FitParameterWidget ( QWidget *  parent = nullptr)

Definition at line 39 of file FitParameterWidget.cpp.

40  : SessionItemWidget(parent)
41  , m_treeView(new QTreeView)
42  , m_tuningWidget(nullptr)
43  , m_createFitParAction(nullptr)
44  , m_removeFromFitParAction(nullptr)
45  , m_removeFitParAction(nullptr)
46  , m_fitParameterModel(nullptr)
49 {
50  auto* layout = new QVBoxLayout(this);
51  layout->addWidget(m_treeView);
52  layout->setMargin(0);
53  layout->setSpacing(0);
54  init_actions();
55 
56  m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
57  m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
58  m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
59  m_treeView->setItemDelegate(new FitParameterDelegate(this));
60  m_treeView->setDragEnabled(true);
61  m_treeView->setDragDropMode(QAbstractItemView::DragDrop);
62  m_treeView->installEventFilter(m_keyboardFilter);
63  m_treeView->setAlternatingRowColors(true);
64  m_treeView->setStyleSheet("alternate-background-color: #EFF0F1;");
65 
66  connect(m_treeView, &QTreeView::customContextMenuRequested, this,
68 
70  m_infoLabel->setText("Drop parameter(s) to fit here");
71 }
Lisens for press-del-key events.
The FitParameterDelegate class presents the content of SessionModel items in standard QTreeView....
ParameterTuningWidget * m_tuningWidget
void onFitParameterTreeContextMenu(const QPoint &point)
Creates context menu for the tree with fit parameters.
QAction * m_createFitParAction
FitParameterModel * m_fitParameterModel
QAction * m_removeFitParAction
OverlayLabelController * m_infoLabel
DeleteEventFilter * m_keyboardFilter
QAction * m_removeFromFitParAction
The OverlayLabelController class controlls appearance of InfoLabelWidget (position,...
void setArea(QAbstractScrollArea *area)
void setText(const QString &text)
SessionItemWidget(QWidget *parent=nullptr)

References init_actions(), m_infoLabel, m_keyboardFilter, m_treeView, onFitParameterTreeContextMenu(), OverlayLabelController::setArea(), and OverlayLabelController::setText().

Here is the call graph for this function:

Member Function Documentation

◆ actionList()

QList< QAction * > SessionItemWidget::actionList ( )
virtualinherited

◆ canCreateFitParameter()

bool FitParameterWidget::canCreateFitParameter ( )
private

Returns true if tuning widget contains selected ParameterItem's which can be used to create a fit parameter (i.e. it is not linked with some fit parameter already).

Definition at line 266 of file FitParameterWidget.cpp.

267 {
268  QVector<ParameterItem*> selected = m_tuningWidget->getSelectedParameters();
269  for (auto* item : selected) {
270  if (jobItem()->fitParameterContainerItem()->fitParameterItem(item) == nullptr)
271  return true;
272  }
273  return false;
274 }
QVector< ParameterItem * > getSelectedParameters()
Returns list of ParameterItem's currently selected in parameter tree.

References ParameterTuningWidget::getSelectedParameters(), jobItem(), and m_tuningWidget.

Referenced by onTuningWidgetContextMenu().

Here is the call graph for this function:

◆ canRemoveFromFitParameters()

bool FitParameterWidget::canRemoveFromFitParameters ( )
private

Returns true if tuning widget contains selected ParameterItem's which can be removed from fit parameters.

Definition at line 279 of file FitParameterWidget.cpp.

280 {
281  QVector<ParameterItem*> selected = m_tuningWidget->getSelectedParameters();
282  for (auto* item : selected) {
283  if (jobItem()->fitParameterContainerItem()->fitParameterItem(item))
284  return true;
285  }
286  return false;
287 }

References ParameterTuningWidget::getSelectedParameters(), jobItem(), and m_tuningWidget.

Referenced by onTuningWidgetContextMenu().

Here is the call graph for this function:

◆ connectFitParametersSelection()

void FitParameterWidget::connectFitParametersSelection ( bool  active)
private

Definition at line 372 of file FitParameterWidget.cpp.

373 {
374  if (active) {
375  connect(m_treeView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
377  } else {
378  disconnect(m_treeView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
380  }
381 }
void onFitParametersSelectionChanged(const QItemSelection &selection)
Propagates selection form the tree with fit parameters to the tuning widget.

References m_treeView, and onFitParametersSelectionChanged().

Referenced by init_fit_model().

Here is the call graph for this function:

◆ currentItem() [1/2]

◆ currentItem() [2/2]

const SessionItem * SessionItemWidget::currentItem ( ) const
inherited

Definition at line 46 of file SessionItemWidget.cpp.

47 {
48  return m_itemController->currentItem();
49 }
SessionItemController * m_itemController

References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.

Here is the call graph for this function:

◆ emptyFitParameters()

QVector< FitParameterItem * > FitParameterWidget::emptyFitParameters ( )
private

Returns list of FitParameterItem's which doesn't have any links attached.

Definition at line 318 of file FitParameterWidget.cpp.

319 {
320  QVector<FitParameterItem*> result;
321  for (auto* fitParItem : jobItem()->fitParameterContainerItem()->fitParameterItems())
322  if (fitParItem->linkItems().empty())
323  result.push_back(fitParItem);
324 
325  return result;
326 }

References jobItem().

Here is the call graph for this function:

◆ hideEvent()

void SessionItemWidget::hideEvent ( QHideEvent *  )
overrideprotectedinherited

Definition at line 56 of file SessionItemWidget.cpp.

57 {
59 }
void unsubscribe()
Fully unsubscribes the parent from listening item's signals. Controller stays active to track item de...

References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().

Here is the call graph for this function:

◆ init_actions()

void FitParameterWidget::init_actions ( )
private

Definition at line 225 of file FitParameterWidget.cpp.

226 {
227  m_createFitParAction = new QAction("Create fit parameter", this);
228  connect(m_createFitParAction, &QAction::triggered, this,
230 
231  m_removeFromFitParAction = new QAction("Remove from fit parameters", this);
232  connect(m_removeFromFitParAction, &QAction::triggered, this,
234 
235  m_removeFitParAction = new QAction("Remove fit parameter", this);
236  connect(m_removeFitParAction, &QAction::triggered, this,
238 
241 }
void onCreateFitParAction()
Creates fit parameters for all selected ParameterItem's in tuning widget.
void onRemoveFromFitParAction()
All ParameterItem's selected in tuning widget will be removed from link section of corresponding fitP...
void onRemoveFitParAction()
All selected FitParameterItem's of FitParameterItemLink's will be removed.

References m_createFitParAction, m_keyboardFilter, m_removeFitParAction, m_removeFromFitParAction, onCreateFitParAction(), onRemoveFitParAction(), onRemoveFromFitParAction(), and DeleteEventFilter::removeItem().

Referenced by FitParameterWidget().

Here is the call graph for this function:

◆ init_fit_model()

void FitParameterWidget::init_fit_model ( )
private

Initializes FitParameterModel and its tree.

Definition at line 245 of file FitParameterWidget.cpp.

246 {
247  m_treeView->setModel(nullptr);
248 
249  delete m_fitParameterModel;
250  m_fitParameterModel = new FitParameterModel(jobItem()->fitParameterContainerItem(),
251  jobItem()->fitParameterContainerItem()->model());
252  m_treeView->setModel(m_fitParameterModel);
253 
254  connect(m_fitParameterModel, &FitParameterModel::dataChanged, this,
256  connect(m_fitParameterModel, &FitParameterModel::modelReset, this,
258 
261 }
Model to show items from FitParameterContainer in 5 column tree view.
void connectFitParametersSelection(bool active)

References connectFitParametersSelection(), jobItem(), m_fitParameterModel, m_treeView, and onFitParameterModelChange().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ jobItem()

JobItem * FitParameterWidget::jobItem ( )
private

Definition at line 383 of file FitParameterWidget.cpp.

384 {
385  return dynamic_cast<JobItem*>(currentItem());
386 }

References SessionItemWidget::currentItem().

Referenced by canCreateFitParameter(), canRemoveFromFitParameters(), emptyFitParameters(), init_fit_model(), onAddToFitParAction(), onCreateFitParAction(), onFitParametersSelectionChanged(), onFitParameterTreeContextMenu(), onRemoveFitParAction(), onRemoveFromFitParAction(), onTuningWidgetContextMenu(), and updateInfoLabel().

Here is the call graph for this function:

◆ onAddToFitParAction

void FitParameterWidget::onAddToFitParAction ( int  ipar)
privateslot

Add all selected parameters to fitParameter with given index.

Definition at line 207 of file FitParameterWidget.cpp.

208 {
209  const QString fitParName = jobItem()->fitParameterContainerItem()->fitParameterNames().at(ipar);
210  for (auto* item : m_tuningWidget->getSelectedParameters())
211  jobItem()->fitParameterContainerItem()->addToFitParameter(item, fitParName);
212 }
QStringList fitParameterNames() const
Returns list of fit parameter display names.
void addToFitParameter(ParameterItem *parameterItem, const QString &fitParName)
Adds given parameterItem to the existing fit parameter with display name fitParName....
FitParameterContainerItem * fitParameterContainerItem()
Definition: JobItem.cpp:282

References FitParameterContainerItem::addToFitParameter(), JobItem::fitParameterContainerItem(), FitParameterContainerItem::fitParameterNames(), ParameterTuningWidget::getSelectedParameters(), jobItem(), and m_tuningWidget.

Referenced by onTuningWidgetContextMenu().

Here is the call graph for this function:

◆ onCreateFitParAction

void FitParameterWidget::onCreateFitParAction ( )
privateslot

Creates fit parameters for all selected ParameterItem's in tuning widget.

Definition at line 167 of file FitParameterWidget.cpp.

168 {
169  for (auto* item : m_tuningWidget->getSelectedParameters())
170  if (!jobItem()->fitParameterContainerItem()->fitParameterItem(item))
172 }
void createFitParameter(ParameterItem *parameterItem)
Creates fit parameter from given ParameterItem, sets starting value to the value of ParameterItem,...

References FitParameterContainerItem::createFitParameter(), JobItem::fitParameterContainerItem(), ParameterTuningWidget::getSelectedParameters(), jobItem(), and m_tuningWidget.

Referenced by init_actions().

Here is the call graph for this function:

◆ onFitParameterModelChange

void FitParameterWidget::onFitParameterModelChange ( )
privateslot

Definition at line 214 of file FitParameterWidget.cpp.

215 {
216  spanParameters();
217  updateInfoLabel();
218 }
void spanParameters()
Makes first column in FitParameterItem's tree related to ParameterItem link occupy whole space.
void updateInfoLabel()
Places overlay label on top of tree view, if there is no fit parameters.

References spanParameters(), and updateInfoLabel().

Referenced by init_fit_model().

Here is the call graph for this function:

◆ onFitParametersSelectionChanged

void FitParameterWidget::onFitParametersSelectionChanged ( const QItemSelection &  selection)
slot

Propagates selection form the tree with fit parameters to the tuning widget.

Definition at line 149 of file FitParameterWidget.cpp.

150 {
151  if (selection.indexes().isEmpty())
152  return;
153 
154  for (auto index : selection.indexes()) {
155  m_tuningWidget->selectionModel()->clearSelection();
157  if (item->parentItem()->hasModelType<FitParameterLinkItem>()) {
158  QString link = polymorphic_downcast<FitParameterLinkItem*>(item->parentItem())->link();
160  jobItem()->parameterContainerItem()->findParameterItem(link));
161  }
162  }
163 }
The FitParameterLinkItem class holds a link to ParameterItem in tuning tree.
SessionItem * itemForIndex(const QModelIndex &index) const
void makeSelected(ParameterItem *item)
QItemSelectionModel * selectionModel()
bool hasModelType() const
Definition: SessionItem.h:421
SessionItem * parentItem() const
Returns parent of this item.
Definition: SessionItem.cpp:67

References SessionItem::hasModelType(), FitParameterModel::itemForIndex(), jobItem(), m_fitParameterModel, m_tuningWidget, ParameterTuningWidget::makeSelected(), SessionItem::parentItem(), and ParameterTuningWidget::selectionModel().

Referenced by connectFitParametersSelection().

Here is the call graph for this function:

◆ onFitParameterTreeContextMenu

void FitParameterWidget::onFitParameterTreeContextMenu ( const QPoint &  point)
slot

Creates context menu for the tree with fit parameters.

Definition at line 132 of file FitParameterWidget.cpp.

133 {
134  if (jobItem()->getStatus() == JobStatus::Fitting) {
135  setActionsEnabled(false);
136  return;
137  }
138  if (jobItem()->fitParameterContainerItem()->isEmpty())
139  return;
140 
141  QMenu menu;
142  menu.addAction(m_removeFitParAction);
143  menu.exec(m_treeView->viewport()->mapToGlobal(point));
144  setActionsEnabled(true);
145 }
@ Fitting
the job is busy fitting
void setActionsEnabled(bool value)
Enables/disables all context menu actions.

References Fitting, jobItem(), m_removeFitParAction, m_treeView, and setActionsEnabled().

Referenced by FitParameterWidget().

Here is the call graph for this function:

◆ onRemoveFitParAction

void FitParameterWidget::onRemoveFitParAction ( )
privateslot

All selected FitParameterItem's of FitParameterItemLink's will be removed.

Definition at line 185 of file FitParameterWidget.cpp.

186 {
188 
189  // retrieve both, selected FitParameterItem and FitParameterItemLink
190  const auto linksToRemove = selectedFitParameterLinks();
191 
192  for (const auto& link : linksToRemove)
193  for (auto* fitParItem : container->fitParameterItems())
194  fitParItem->removeLink(link);
195 
196  QVector<FitParameterItem*> itemsToRemove = selectedFitParameters();
197  // By uncommenting line below, removing link from fit parameter will lead to fit parameter
198  // removal too (if it doesn't have other links)
199  // QVector<FitParameterItem *> itemsToRemove = selectedFitParameters()+emptyFitParameters();
200 
201  for (auto* item : itemsToRemove)
202  container->model()->removeRow(item->index().row(), item->index().parent());
203 }
The FitParameterContainerItem class is a collection of all defined fit parameters in JobItem.
QVector< FitParameterItem * > fitParameterItems() const
QVector< FitParameterItem * > selectedFitParameters()
Returns list of FitParameterItem's currently selected in FitParameterItem tree.
QStringList selectedFitParameterLinks()
Returns links of FitParameterLink's item selected in FitParameterItem tree.
SessionModel * model() const
Returns model of this item.
Definition: SessionItem.cpp:60

References JobItem::fitParameterContainerItem(), FitParameterContainerItem::fitParameterItems(), jobItem(), SessionItem::model(), selectedFitParameterLinks(), and selectedFitParameters().

Referenced by init_actions().

Here is the call graph for this function:

◆ onRemoveFromFitParAction

void FitParameterWidget::onRemoveFromFitParAction ( )
privateslot

All ParameterItem's selected in tuning widget will be removed from link section of corresponding fitParameterItem.

Definition at line 177 of file FitParameterWidget.cpp.

178 {
179  for (auto* item : m_tuningWidget->getSelectedParameters())
181 }
void removeLink(const ParameterItem *parameterItem)

References JobItem::fitParameterContainerItem(), ParameterTuningWidget::getSelectedParameters(), jobItem(), m_tuningWidget, and FitParameterContainerItem::removeLink().

Referenced by init_actions().

Here is the call graph for this function:

◆ onTuningWidgetContextMenu

void FitParameterWidget::onTuningWidgetContextMenu ( const QPoint &  point)
slot

Creates context menu for ParameterTuningWidget.

Definition at line 96 of file FitParameterWidget.cpp.

97 {
98  QMenu menu;
99 
100  if (jobItem()->getStatus() == JobStatus::Fitting) {
101  setActionsEnabled(false);
102  return;
103  }
104 
107 
108  menu.addAction(m_createFitParAction);
109  QMenu* addToFitParMenu = menu.addMenu("Add to existing fit parameter");
110  addToFitParMenu->setEnabled(true);
111 
112  const bool allow_one_fit_parameter_to_have_more_than_one_link = true;
113  if (allow_one_fit_parameter_to_have_more_than_one_link) {
114  QStringList fitParNames = jobItem()->fitParameterContainerItem()->fitParameterNames();
115  if (fitParNames.isEmpty() || !canCreateFitParameter())
116  addToFitParMenu->setEnabled(false);
117  for (int i = 0; i < fitParNames.count(); ++i) {
118  auto* action = new QAction(QString("to ").append(fitParNames.at(i)), addToFitParMenu);
119  connect(action, &QAction::triggered, [=] { onAddToFitParAction(i); });
120  addToFitParMenu->addAction(action);
121  }
122  }
123  menu.addSeparator();
124  menu.addAction(m_removeFromFitParAction);
125 
126  menu.exec(point);
127  setActionsEnabled(true);
128 }
void onAddToFitParAction(int ipar)
Add all selected parameters to fitParameter with given index.
bool canRemoveFromFitParameters()
Returns true if tuning widget contains selected ParameterItem's which can be removed from fit paramet...
bool canCreateFitParameter()
Returns true if tuning widget contains selected ParameterItem's which can be used to create a fit par...

References canCreateFitParameter(), canRemoveFromFitParameters(), JobItem::fitParameterContainerItem(), FitParameterContainerItem::fitParameterNames(), Fitting, jobItem(), m_createFitParAction, m_removeFromFitParAction, onAddToFitParAction(), and setActionsEnabled().

Referenced by setParameterTuningWidget().

Here is the call graph for this function:

◆ selectedFitParameterLinks()

QStringList FitParameterWidget::selectedFitParameterLinks ( )
private

Returns links of FitParameterLink's item selected in FitParameterItem tree.

Definition at line 330 of file FitParameterWidget.cpp.

331 {
332  QStringList result;
333  QModelIndexList indexes = m_treeView->selectionModel()->selectedIndexes();
334  for (QModelIndex index : indexes) {
335  if (SessionItem* item = m_fitParameterModel->itemForIndex(index)) {
336  if (item->parentItem()->hasModelType<FitParameterLinkItem>()) {
337  auto* fitParItem = dynamic_cast<FitParameterLinkItem*>(item->parentItem());
338  ASSERT(fitParItem);
339  result.push_back(fitParItem->link());
340  }
341  }
342  }
343  return result;
344 }

References FitParameterModel::itemForIndex(), m_fitParameterModel, and m_treeView.

Referenced by onRemoveFitParAction().

Here is the call graph for this function:

◆ selectedFitParameters()

QVector< FitParameterItem * > FitParameterWidget::selectedFitParameters ( )
private

Returns list of FitParameterItem's currently selected in FitParameterItem tree.

Definition at line 300 of file FitParameterWidget.cpp.

301 {
302  QVector<FitParameterItem*> result;
303  QModelIndexList indexes = m_treeView->selectionModel()->selectedIndexes();
304  for (auto index : indexes) {
305  if (SessionItem* item = m_fitParameterModel->itemForIndex(index)) {
306  if (item->hasModelType<FitParameterItem>()) {
307  auto* fitParItem = dynamic_cast<FitParameterItem*>(item);
308  ASSERT(fitParItem);
309  result.push_back(fitParItem);
310  }
311  }
312  }
313  return result;
314 }
FitParameterItems is a collection of items to define fit parameters in GUI.

References FitParameterModel::itemForIndex(), m_fitParameterModel, and m_treeView.

Referenced by onRemoveFitParAction().

Here is the call graph for this function:

◆ setActionsEnabled()

void FitParameterWidget::setActionsEnabled ( bool  value)
private

Enables/disables all context menu actions.

Definition at line 291 of file FitParameterWidget.cpp.

292 {
293  m_createFitParAction->setEnabled(value);
294  m_removeFromFitParAction->setEnabled(value);
295  m_removeFitParAction->setEnabled(value);
296 }

References m_createFitParAction, m_removeFitParAction, and m_removeFromFitParAction.

Referenced by onFitParameterTreeContextMenu(), and onTuningWidgetContextMenu().

◆ setItem()

◆ setParameterTuningWidget()

void FitParameterWidget::setParameterTuningWidget ( ParameterTuningWidget tuningWidget)

Sets ParameterTuningWidget to be able to provide it with context menu and steer its behaviour in the course of fit settings or fit running.

Definition at line 76 of file FitParameterWidget.cpp.

77 {
78  if (tuningWidget == m_tuningWidget)
79  return;
80 
81  if (m_tuningWidget)
84 
85  m_tuningWidget = tuningWidget;
86  if (!m_tuningWidget)
87  return;
88 
90  &FitParameterWidget::onTuningWidgetContextMenu, Qt::UniqueConnection);
91  connect(m_tuningWidget, &QObject::destroyed, [this] { m_tuningWidget = nullptr; });
92 }
void onTuningWidgetContextMenu(const QPoint &point)
Creates context menu for ParameterTuningWidget.
void itemContextMenuRequest(const QPoint &point)

References ParameterTuningWidget::itemContextMenuRequest(), m_tuningWidget, and onTuningWidgetContextMenu().

Referenced by FitSessionWidget::setModelTuningWidget().

Here is the call graph for this function:

◆ showEvent()

void SessionItemWidget::showEvent ( QShowEvent *  )
overrideprotectedinherited

Definition at line 51 of file SessionItemWidget.cpp.

52 {
54 }

References SessionItemWidget::m_itemController, and SessionItemController::subscribe().

Here is the call graph for this function:

◆ spanParameters()

void FitParameterWidget::spanParameters ( )
private

Makes first column in FitParameterItem's tree related to ParameterItem link occupy whole space.

Definition at line 348 of file FitParameterWidget.cpp.

349 {
350  m_treeView->expandAll();
351  for (int i = 0; i < m_fitParameterModel->rowCount(QModelIndex()); i++) {
352  QModelIndex parameter = m_fitParameterModel->index(i, 0, QModelIndex());
353  if (!parameter.isValid())
354  break;
355  int childRowCount = m_fitParameterModel->rowCount(parameter);
356  if (childRowCount > 0) {
357  for (int j = 0; j < childRowCount; j++)
358  m_treeView->setFirstColumnSpanned(j, parameter, true);
359  }
360  }
361 }
int rowCount(const QModelIndex &parent) const override
QModelIndex index(int row, int column, const QModelIndex &parent) const override

References FitParameterModel::index(), m_fitParameterModel, m_treeView, and FitParameterModel::rowCount().

Referenced by onFitParameterModelChange().

Here is the call graph for this function:

◆ subscribeToItem()

void FitParameterWidget::subscribeToItem ( )
overrideprotectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 220 of file FitParameterWidget.cpp.

221 {
222  init_fit_model();
223 }
void init_fit_model()
Initializes FitParameterModel and its tree.

References init_fit_model().

Here is the call graph for this function:

◆ unsubscribeFromItem()

virtual void SessionItemWidget::unsubscribeFromItem ( )
inlineprotectedvirtualinherited

◆ updateInfoLabel()

void FitParameterWidget::updateInfoLabel ( )
private

Places overlay label on top of tree view, if there is no fit parameters.

Definition at line 364 of file FitParameterWidget.cpp.

365 {
366  if (!jobItem())
367  return;
368 
369  m_infoLabel->setShown(jobItem()->fitParameterContainerItem()->isEmpty());
370 }
void setShown(bool shown)
Shows/removes a label from the controlled widget.

References jobItem(), m_infoLabel, and OverlayLabelController::setShown().

Referenced by onFitParameterModelChange().

Here is the call graph for this function:

Member Data Documentation

◆ m_createFitParAction

QAction* FitParameterWidget::m_createFitParAction
private

Definition at line 79 of file FitParameterWidget.h.

Referenced by init_actions(), onTuningWidgetContextMenu(), and setActionsEnabled().

◆ m_fitParameterModel

FitParameterModel* FitParameterWidget::m_fitParameterModel
private

◆ m_infoLabel

OverlayLabelController* FitParameterWidget::m_infoLabel
private

Definition at line 84 of file FitParameterWidget.h.

Referenced by FitParameterWidget(), and updateInfoLabel().

◆ m_itemController

◆ m_keyboardFilter

DeleteEventFilter* FitParameterWidget::m_keyboardFilter
private

Definition at line 83 of file FitParameterWidget.h.

Referenced by FitParameterWidget(), and init_actions().

◆ m_removeFitParAction

QAction* FitParameterWidget::m_removeFitParAction
private

◆ m_removeFromFitParAction

QAction* FitParameterWidget::m_removeFromFitParAction
private

Definition at line 80 of file FitParameterWidget.h.

Referenced by init_actions(), onTuningWidgetContextMenu(), and setActionsEnabled().

◆ m_treeView

◆ m_tuningWidget


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