BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ParameterTuningModel.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Model/ParameterTuningModel.h
6 //! @brief Defines class ParameterTuningModel
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_MODEL_MODEL_PARAMETERTUNINGMODEL_H
16 #define BORNAGAIN_GUI_MODEL_MODEL_PARAMETERTUNINGMODEL_H
17 
18 class ParameterItem;
19 class ParameterLabelItem;
20 
21 #include <QAbstractItemModel>
22 
23 //!
24 //! \brief The ParameterTuningModel class represents parameters which can be tuned in real time
25 //! in ParameterTuningWidget. In the fitting activity context handles dragging of ParameterItem's
26 //! to the FitParametersWidget.
27 //!
28 
29 class ParameterTuningModel : public QAbstractItemModel {
30  Q_OBJECT
31 
32 public:
33  ParameterTuningModel(QObject* rootObject, QObject* parent = nullptr);
34 
35  QVariant headerData(int section, Qt::Orientation orientation,
36  int role /* = Qt::DisplayRole */) const override;
37  QVariant data(const QModelIndex& index, int role) const override;
38  Qt::ItemFlags flags(const QModelIndex& index) const override;
39  QModelIndex index(int row, int column,
40  const QModelIndex& parent = QModelIndex()) const override;
41  QModelIndex parent(const QModelIndex& index) const override;
42  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
43  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
44 
45  QMimeData* mimeData(const QModelIndexList& indexes) const override;
46  Qt::DropActions supportedDragActions() const override;
47  Qt::DropActions supportedDropActions() const override;
48 
49  //! Returns ParameterItem from given index
50  ParameterItem* getParameterItem(const QModelIndex& index) const;
51  QModelIndex indexForItem(ParameterItem* item) const;
52 
53  static ParameterItem* toParameterItem(const QModelIndex& index);
54  static ParameterLabelItem* toParameterLabelItem(const QModelIndex& index);
55 
56 private:
57  QObject* m_rootObject;
58 };
59 
60 #endif // BORNAGAIN_GUI_MODEL_MODEL_PARAMETERTUNINGMODEL_H
The ParameterItem class represent a tuning value in a parameter tuning tree.
ParameterTreeItems is a collection of items necessary to form a tuning tree for real time widget.
The ParameterTuningModel class represents parameters which can be tuned in real time in ParameterTuni...
QModelIndex indexForItem(ParameterItem *item) const
Qt::DropActions supportedDropActions() const override
ParameterTuningModel(QObject *rootObject, QObject *parent=nullptr)
static ParameterLabelItem * toParameterLabelItem(const QModelIndex &index)
static ParameterItem * toParameterItem(const QModelIndex &index)
Qt::ItemFlags flags(const QModelIndex &index) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
ParameterItem * getParameterItem(const QModelIndex &index) const
Returns ParameterItem from given index.
QMimeData * mimeData(const QModelIndexList &indexes) const override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Qt::DropActions supportedDragActions() const override
QModelIndex parent(const QModelIndex &index) const override
QVariant data(const QModelIndex &index, int role) const override