23 static QColor backgroundColorFileContent;
24 static QColor backgroundColorRawContent;
25 static QColor backgroundColorProcessedContent;
26 static QColor backgroundColorErrors;
27 static QColor skippedLineTextColor;
30 QColor Palette::backgroundColorFileContent(239, 237, 248);
31 QColor Palette::backgroundColorRawContent(247, 240, 210);
32 QColor Palette::backgroundColorProcessedContent(191, 232, 242);
33 QColor Palette::backgroundColorErrors(247, 140, 146);
34 QColor Palette::skippedLineTextColor(Qt::lightGray);
60 return parent.isValid() ? 0 :
rowCount();
71 if (role == Qt::BackgroundRole) {
75 return Palette::backgroundColorFileContent;
77 return rowIsSkipped(index) ? QVariant() : Palette::backgroundColorRawContent;
81 : Palette::backgroundColorProcessedContent;
84 : Palette::backgroundColorErrors;
90 if (role == Qt::ForegroundRole) {
92 return Palette::skippedLineTextColor;
96 if (role == Qt::DisplayRole) {
99 return QString::number(index.row() + 1);
102 QString lineContent =
104 lineContent.replace(
"\t",
" --> ");
111 return cellText(colType, index.row(),
117 return cellText(colType, index.row(),
132 return QVariant(Qt::AlignRight | Qt::AlignVCenter);
143 if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
148 return "File content (text)";
150 return QString(
"Column %1 raw")
156 return "Parser warnings";
162 return QAbstractTableModel::headerData(section, orientation, role);
167 QVector<int> sections;
184 if (firstSection < 0)
206 return lineColumnCount > 0 ? 0 : -1;
213 return hasRawContent ? lineColumnCount + fileContentColumnCount : -1;
218 return hasProcessedContent
225 return hasParsingErrors
237 if (firstSection == -1)
Defines class AbstractDataLoaderResultModel.
virtual QString headerTextOfCalculatedColumn(int column) const =0
Return the table header text for the given column. For convenience, column starts at 0 for first calc...
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
int firstSectionOfColumnType(ColumnType type) const
Calculates the first real header view section of the given column type. Returns -1 if the column type...
AbstractDataLoaderResultModel()
QVector< int > sectionsOfColumnType(ColumnType type) const
The table header sections which belong to the given column type. Empty if this column type is not pre...
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
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,...
virtual bool rowHasError(const QModelIndex &index) const
Returns whether the row given in the index contains errors. Only override this for performance reason...
ColumnType columnType(const QModelIndex &index) const
Calculates the column type of the given index.
virtual int rowCount() const =0
The row count of the result table.
int lastSectionOfColumnType(ColumnType type) const
Calculates the last real header view section of the given column type. Returns -1 if the column type ...
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override