BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
AutomaticDataLoader1DResultModel.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Loaders/AutomaticDataLoader1DResultModel.cpp
6 //! @brief Implements class AutomaticDataLoader1DResultModel
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 
16 #include "Base/Axis/Frame.h"
19 
21  : m_item(item)
22 {
23 }
24 
26 {
27  return false;
28 }
29 
31 {
33  if (!data)
34  return 0;
35 
36  return int(data->size());
37 }
38 
40 {
41  return false;
42 }
43 
45 {
46  switch (column) {
47  case 0:
48  return "Q [1/nm]";
49  case 1:
50  return "R";
51  default:
52  return "";
53  }
54 }
55 
57 {
58  return (type == ColumnType::processed) ? 2 : 0;
59 }
60 
61 QString AutomaticDataLoader1DResultModel::cellText(ColumnType type, int row, int col) const
62 {
63  if (col < 0 || row < 0 || row >= rowCount() || type != ColumnType::processed)
64  return QString();
65 
67 
68  if (col == 0)
69  return QString::number(data->frame().projectedCoord(row, 0));
70 
71  if (col == 1)
72  return QString::number(data->operator[](row));
73 
74  return QString();
75 }
Defines class AutomaticDataLoader1DResultModel.
Defines class RealDataItem.
Defines class SpecularDataItem.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
virtual bool rowIsSkipped(const QModelIndex &index) const
Returns whether the row given in the index is a skipped row. Only override this for performance reaso...
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QString cellText(ColumnType type, int row, int col) const override
The text of the given cell. For convenience, column starts at 0 for the given column type,...
virtual bool rowHasError(const QModelIndex &index) const
Returns whether the row given in the index contains errors. Only override this for performance reason...
int rowCount() const override
The row count of the result table.
QString headerTextOfCalculatedColumn(int column) const override
Return the table header text for the given column. For convenience, column starts at 0 for first calc...
Datafield * getDatafield()
Definition: DataItem.h:41
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
Definition: RealDataItem.h:33
SpecularDataItem * specularDataItem()