BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Base class for result tables of data loaders. Derive from this class and return an instance in YourDataLoader::createResultModel(). The result table is the one on the right side when importing CSV files.
Definition at line 24 of file AbstractDataLoaderResultModel.h.
Public Types | |
enum class | ColumnType { none , line , fileContent , raw , processed , error } |
Public Member Functions | |
AbstractDataLoaderResultModel () | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
int | rowCount (const QModelIndex &parent) const override |
QVector< int > | sectionsOfColumnType (ColumnType type) const |
The table header sections which belong to the given column type. Empty if this column type is not present at all. More... | |
Protected Member Functions | |
virtual QString | cellText (ColumnType type, int row, int column) const =0 |
The text of the given cell. For convenience, column starts at 0 for the given column type, therefore it is not the same as the "real" section in the table header. This method will not be called for every row/column present in the table. Instead, optimizations will be done before calling it. E.g. the calculated values for lines which contain errors will never be called. Also raw or calculated contents will not be queried if a line is skipped. More... | |
virtual int | columnCount (ColumnType type) const =0 |
The number of existing columns related to the given column type. 0 if the type is not present at all. More... | |
virtual QString | headerTextOfCalculatedColumn (int column) const =0 |
Return the table header text for the given column. For convenience, column starts at 0 for first calculated column, therefore it is not the same as the "real" section in the table header. More... | |
virtual int | rowCount () const =0 |
The row count of the result table. More... | |
virtual bool | rowHasError (const QModelIndex &index) const |
Returns whether the row given in the index contains errors. Only override this for performance reasons. More... | |
virtual bool | rowHasError (int row) const =0 |
Returns whether the row given in the index contains errors. Row counting starts with 0. More... | |
virtual bool | rowIsSkipped (const QModelIndex &index) const |
Returns whether the row given in the index is a skipped row. Only override this for performance reasons. More... | |
virtual bool | rowIsSkipped (int row) const =0 |
Returns whether the row given in the index is a skipped row. Row counting starts with 0. More... | |
Private Member Functions | |
ColumnType | columnType (const QModelIndex &index) const |
Calculates the column type of the given index. More... | |
ColumnType | columnType (int section) const |
Calculates the column type of the real header view section. More... | |
int | firstSectionOfColumnType (ColumnType type) const |
Calculates the first real header view section of the given column type. Returns -1 if the column type does not exist. More... | |
int | lastSectionOfColumnType (ColumnType type) const |
Calculates the last real header view section of the given column type. Returns -1 if the column type does not exist. More... | |
Private Attributes | |
QIcon | m_warningIcon |
|
strong |
Enumerator | |
---|---|
none | |
line | |
fileContent | |
raw | |
processed | |
error |
Definition at line 26 of file AbstractDataLoaderResultModel.h.
AbstractDataLoaderResultModel::AbstractDataLoaderResultModel | ( | ) |
Definition at line 38 of file AbstractDataLoaderResultModel.cpp.
References m_warningIcon.
|
protectedpure virtual |
The text of the given cell. For convenience, column starts at 0 for the given column type, therefore it is not the same as the "real" section in the table header. This method will not be called for every row/column present in the table. Instead, optimizations will be done before calling it. E.g. the calculated values for lines which contain errors will never be called. Also raw or calculated contents will not be queried if a line is skipped.
Implemented in QREDataLoaderResultModel, and AutomaticDataLoader1DResultModel.
Referenced by data().
|
protectedpure virtual |
The number of existing columns related to the given column type. 0 if the type is not present at all.
Implemented in QREDataLoaderResultModel, and AutomaticDataLoader1DResultModel.
|
override |
Definition at line 43 of file AbstractDataLoaderResultModel.cpp.
Referenced by firstSectionOfColumnType(), and lastSectionOfColumnType().
|
private |
Calculates the column type of the given index.
Definition at line 195 of file AbstractDataLoaderResultModel.cpp.
Referenced by data(), and headerData().
|
private |
Calculates the column type of the real header view section.
Definition at line 177 of file AbstractDataLoaderResultModel.cpp.
References error, fileContent, firstSectionOfColumnType(), lastSectionOfColumnType(), line, none, processed, and raw.
|
override |
Definition at line 63 of file AbstractDataLoaderResultModel.cpp.
References cellText(), columnType(), error, fileContent, firstSectionOfColumnType(), line, m_warningIcon, processed, raw, rowHasError(), and rowIsSkipped().
Referenced by AutomaticDataLoader1DResultModel::cellText(), and AutomaticDataLoader1DResultModel::rowCount().
|
private |
Calculates the first real header view section of the given column type. Returns -1 if the column type does not exist.
Definition at line 200 of file AbstractDataLoaderResultModel.cpp.
References columnCount(), error, fileContent, line, processed, and raw.
Referenced by columnType(), data(), headerData(), lastSectionOfColumnType(), and sectionsOfColumnType().
|
override |
Definition at line 140 of file AbstractDataLoaderResultModel.cpp.
References columnType(), error, fileContent, firstSectionOfColumnType(), headerTextOfCalculatedColumn(), line, processed, and raw.
|
protectedpure virtual |
Return the table header text for the given column. For convenience, column starts at 0 for first calculated column, therefore it is not the same as the "real" section in the table header.
Implemented in QREDataLoaderResultModel, and AutomaticDataLoader1DResultModel.
Referenced by headerData().
|
private |
Calculates the last real header view section of the given column type. Returns -1 if the column type does not exist.
Definition at line 234 of file AbstractDataLoaderResultModel.cpp.
References columnCount(), and firstSectionOfColumnType().
Referenced by columnType(), and sectionsOfColumnType().
|
protectedpure virtual |
The row count of the result table.
Implemented in QREDataLoaderResultModel, and AutomaticDataLoader1DResultModel.
Referenced by rowCount().
|
override |
Definition at line 58 of file AbstractDataLoaderResultModel.cpp.
References rowCount().
|
protectedvirtual |
Returns whether the row given in the index contains errors. Only override this for performance reasons.
Definition at line 248 of file AbstractDataLoaderResultModel.cpp.
Referenced by data().
|
protectedpure virtual |
Returns whether the row given in the index contains errors. Row counting starts with 0.
Implemented in QREDataLoaderResultModel, and AutomaticDataLoader1DResultModel.
|
protectedvirtual |
Returns whether the row given in the index is a skipped row. Only override this for performance reasons.
Definition at line 243 of file AbstractDataLoaderResultModel.cpp.
Referenced by data().
|
protectedpure virtual |
Returns whether the row given in the index is a skipped row. Row counting starts with 0.
Implemented in QREDataLoaderResultModel, and AutomaticDataLoader1DResultModel.
QVector< int > AbstractDataLoaderResultModel::sectionsOfColumnType | ( | ColumnType | type | ) | const |
The table header sections which belong to the given column type. Empty if this column type is not present at all.
Definition at line 165 of file AbstractDataLoaderResultModel.cpp.
References firstSectionOfColumnType(), and lastSectionOfColumnType().
Referenced by SpecularDataImportWidget::updatePreview().
|
private |
Definition at line 93 of file AbstractDataLoaderResultModel.h.
Referenced by AbstractDataLoaderResultModel(), and data().