BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitParameterWidget.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Fit/FitParameterWidget.h
6 //! @brief Defines class FitParameterWidget
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_FIT_FITPARAMETERWIDGET_H
16 #define BORNAGAIN_GUI_VIEW_FIT_FITPARAMETERWIDGET_H
17 
19 #include <memory>
20 
21 class JobItem;
23 class QTreeView;
24 class QAction;
25 class QMenu;
26 class FitParameterModel;
27 class ParameterItem;
28 class FitParameterItem;
30 class QItemSelection;
31 class DeleteEventFilter;
33 
34 //! The FitParametersWidget class contains a tree view to set fit parameters (fix/release,
35 //! starting value, min/max bounds). It occupies bottom right corner of JobView.
36 
38  Q_OBJECT
39 public:
40  FitParameterWidget(QWidget* parent = nullptr);
41 
43 
44 public slots:
45  void onTuningWidgetContextMenu(const QPoint& point);
46  void onFitParameterTreeContextMenu(const QPoint& point);
47  void onFitParametersSelectionChanged(const QItemSelection& selection);
48 
49 private slots:
50  void onCreateFitParAction();
52  void onRemoveFitParAction();
53  void onAddToFitParAction(int ipar);
55 
56 protected:
57  void subscribeToItem() override;
58 
59 private:
60  void init_actions();
61  void init_fit_model();
62 
63  bool canCreateFitParameter();
65 
66  void setActionsEnabled(bool value);
67  void connectFitParametersSelection(bool active);
68  JobItem* jobItem();
69 
70  QVector<FitParameterItem*> selectedFitParameters();
71  QVector<FitParameterItem*> emptyFitParameters();
72  QStringList selectedFitParameterLinks();
73 
74  void spanParameters();
75  void updateInfoLabel();
76 
77  QTreeView* m_treeView;
85 };
86 
87 #endif // BORNAGAIN_GUI_VIEW_FIT_FITPARAMETERWIDGET_H
Defines class ItemComboWidget.
Lisens for press-del-key events.
FitParameterItems is a collection of items to define fit parameters in GUI.
The FitParameterLinkItem class holds a link to ParameterItem in tuning tree.
Model to show items from FitParameterContainer in 5 column tree view.
The FitParametersWidget class contains a tree view to set fit parameters (fix/release,...
ParameterTuningWidget * m_tuningWidget
void onAddToFitParAction(int ipar)
Add all selected parameters to fitParameter with given index.
FitParameterWidget(QWidget *parent=nullptr)
void onCreateFitParAction()
Creates fit parameters for all selected ParameterItem's in tuning widget.
QVector< FitParameterItem * > emptyFitParameters()
Returns list of FitParameterItem's which doesn't have any links attached.
QVector< FitParameterItem * > selectedFitParameters()
Returns list of FitParameterItem's currently selected in FitParameterItem tree.
void onFitParameterTreeContextMenu(const QPoint &point)
Creates context menu for the tree with fit parameters.
void spanParameters()
Makes first column in FitParameterItem's tree related to ParameterItem link occupy whole space.
QAction * m_createFitParAction
void setParameterTuningWidget(ParameterTuningWidget *tuningWidget)
Sets ParameterTuningWidget to be able to provide it with context menu and steer its behaviour in the ...
void connectFitParametersSelection(bool active)
void subscribeToItem() override
FitParameterModel * m_fitParameterModel
QAction * m_removeFitParAction
void updateInfoLabel()
Places overlay label on top of tree view, if there is no fit parameters.
void setActionsEnabled(bool value)
Enables/disables all context menu actions.
void onRemoveFromFitParAction()
All ParameterItem's selected in tuning widget will be removed from link section of corresponding fitP...
bool canRemoveFromFitParameters()
Returns true if tuning widget contains selected ParameterItem's which can be removed from fit paramet...
void onTuningWidgetContextMenu(const QPoint &point)
Creates context menu for ParameterTuningWidget.
OverlayLabelController * m_infoLabel
DeleteEventFilter * m_keyboardFilter
void init_fit_model()
Initializes FitParameterModel and its tree.
void onFitParametersSelectionChanged(const QItemSelection &selection)
Propagates selection form the tree with fit parameters to the tuning widget.
bool canCreateFitParameter()
Returns true if tuning widget contains selected ParameterItem's which can be used to create a fit par...
QAction * m_removeFromFitParAction
void onRemoveFitParAction()
All selected FitParameterItem's of FitParameterItemLink's will be removed.
QStringList selectedFitParameterLinks()
Returns links of FitParameterLink's item selected in FitParameterItem tree.
The OverlayLabelController class controlls appearance of InfoLabelWidget (position,...
The ParameterItem class represent a tuning value in a parameter tuning tree.
Main widget for real time parameter tuning. Contains a tree for parameter tuning and the model to pro...
The SessionItemWidget class is a base for all widgets representing the content of SessionItem....