1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/apps/opencs/model/tools/reportmodel.hpp
2022-10-31 21:04:01 +01:00

68 lines
1.5 KiB
C++

#ifndef CSM_TOOLS_REPORTMODEL_H
#define CSM_TOOLS_REPORTMODEL_H
#include <string>
#include <vector>
#include <QAbstractTableModel>
#include <QModelIndex>
#include <QVariant>
#include "../doc/messages.hpp"
namespace CSMWorld
{
class UniversalId;
}
namespace CSMTools
{
class ReportModel : public QAbstractTableModel
{
Q_OBJECT
std::vector<CSMDoc::Message> mRows;
// Fixed columns
enum Columns
{
Column_Type = 0,
Column_Id = 1,
Column_Hint = 2
};
// Configurable columns
int mColumnDescription;
int mColumnField;
int mColumnSeverity;
public:
ReportModel(bool fieldColumn = false, bool severityColumn = true);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
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;
bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
void add(const CSMDoc::Message& message);
void flagAsReplaced(int index);
const CSMWorld::UniversalId& getUniversalId(int row) const;
std::string getHint(int row) const;
void clear();
// Return number of messages with Error or SeriousError severity.
int countErrors() const;
};
}
#endif