BornAgain  1.19.0
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/coregui/Views/FitWidgets/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_COREGUI_VIEWS_FITWIDGETS_FITPARAMETERWIDGET_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_FITWIDGETS_FITPARAMETERWIDGET_H
17 
19 #include <memory>
20 
21 class JobItem;
23 class QTreeView;
24 class QAction;
25 class QMenu;
27 class ParameterItem;
28 class FitParameterItem;
30 class QItemSelection;
32 class DeleteEventFilter;
34 
35 //! The FitParametersWidget class contains a tree view to set fit parameters (fix/release,
36 //! starting value, min/max bounds). It occupies buttom right corner of JobView.
37 
39  Q_OBJECT
40 public:
41  FitParameterWidget(QWidget* parent = 0);
42 
44 
45  // QSize sizeHint() const;
46  // QSize minimumSizeHint() const;
47 
48 public slots:
49  void onTuningWidgetContextMenu(const QPoint& point);
50  void onFitParameterTreeContextMenu(const QPoint& point);
51  void onTuningWidgetSelectionChanged(const QItemSelection& selection);
52  void onFitParametersSelectionChanged(const QItemSelection& selection);
53 
54 private slots:
55  void onCreateFitParAction();
57  void onRemoveFitParAction();
58  void onAddToFitParAction(int ipar);
60 
61 protected:
62  void contextMenuEvent(QContextMenuEvent* event);
63  void subscribeToItem();
64 
65 private:
66  void init_actions();
67  void initTuningWidgetContextMenu(QMenu& menu);
68  void initFitParameterTreeContextMenu(QMenu& menu);
69 
70  void init_fit_model();
71 
72  bool canCreateFitParameter();
74 
75  void setActionsEnabled(bool value);
76  void connectTuningWidgetSelection(bool active);
77  void connectFitParametersSelection(bool active);
78  JobItem* jobItem();
79 
80  QVector<FitParameterItem*> selectedFitParameters();
81  QVector<FitParameterItem*> emptyFitParameters();
82  QVector<FitParameterLinkItem*> selectedFitParameterLinks();
83 
84  void spanParameters();
85  void updateInfoLabel();
86 
87  QTreeView* m_treeView;
96 };
97 
98 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_FITWIDGETS_FITPARAMETERWIDGET_H
Defines class ItemComboWidget.
Lisens for press-del-key events.
The FitParameterItem class represents a fit parameter in GUI.
FitParameterItems is a collection of items to define fit parameters in GUI.
The FitParameterProxyModel adapts the original JobModel to show items from FitParameterContainer in 5...
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.
void connectTuningWidgetSelection(bool active)
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 contextMenuEvent(QContextMenuEvent *event)
Context menu reimplemented to suppress the default one.
void spanParameters()
Makes first column in FitParameterItem's tree related to ParameterItem link occupy whole space.
void initTuningWidgetContextMenu(QMenu &menu)
Fills context menu for ParameterTuningWidget with content.
FitParameterProxyModel * m_fitParameterModel
QAction * m_createFitParAction
void setParameterTuningWidget(ParameterTuningWidget *tuningWidget)
Sets ParameterTuningWidget to be able to provide it with context menu and steer it behaviour in the c...
void connectFitParametersSelection(bool active)
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...
FitParameterWidget(QWidget *parent=0)
void initFitParameterTreeContextMenu(QMenu &menu)
Fills context menu for FitParameterTree with content.
void onTuningWidgetSelectionChanged(const QItemSelection &selection)
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
SessionModelDelegate * m_delegate
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.
QVector< FitParameterLinkItem * > 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.
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
The SessionModelDelegate class presents the content of SessionModel items in standard QTreeView.