1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 20:53:53 +00:00
openmw/apps/opencs/model/tools/reportmodel.hpp

68 lines
1.5 KiB
C++
Raw Normal View History

2012-12-11 14:35:47 +00:00
#ifndef CSM_TOOLS_REPORTMODEL_H
#define CSM_TOOLS_REPORTMODEL_H
#include <string>
2022-09-22 18:26:05 +00:00
#include <vector>
2012-12-11 14:35:47 +00:00
#include <QAbstractTableModel>
2022-10-19 17:02:00 +00:00
#include <QModelIndex>
#include <QVariant>
2012-12-11 14:35:47 +00:00
#include "../doc/messages.hpp"
2022-10-19 17:02:00 +00:00
namespace CSMWorld
{
class UniversalId;
}
2012-12-11 14:35:47 +00:00
namespace CSMTools
{
class ReportModel : public QAbstractTableModel
{
2022-09-22 18:26:05 +00:00
Q_OBJECT
std::vector<CSMDoc::Message> mRows;
// Fixed columns
enum Columns
{
Column_Type = 0,
Column_Id = 1,
Column_Hint = 2
};
2012-12-11 14:35:47 +00:00
2022-09-22 18:26:05 +00:00
// Configurable columns
int mColumnDescription;
int mColumnField;
int mColumnSeverity;
2012-12-11 14:35:47 +00:00
2022-09-22 18:26:05 +00:00
public:
ReportModel(bool fieldColumn = false, bool severityColumn = true);
2015-03-29 11:55:31 +00:00
2022-09-22 18:26:05 +00:00
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
2015-03-29 13:28:31 +00:00
2022-09-22 18:26:05 +00:00
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
2012-12-11 14:35:47 +00:00
2022-09-22 18:26:05 +00:00
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
2012-12-11 14:35:47 +00:00
2022-09-22 18:26:05 +00:00
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
2012-12-11 14:35:47 +00:00
2022-09-22 18:26:05 +00:00
bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
2012-12-11 14:35:47 +00:00
2022-09-22 18:26:05 +00:00
void add(const CSMDoc::Message& message);
2012-12-11 14:35:47 +00:00
2022-09-22 18:26:05 +00:00
void flagAsReplaced(int index);
2022-09-22 18:26:05 +00:00
const CSMWorld::UniversalId& getUniversalId(int row) const;
2022-09-22 18:26:05 +00:00
std::string getHint(int row) const;
2022-09-22 18:26:05 +00:00
void clear();
2022-09-22 18:26:05 +00:00
// Return number of messages with Error or SeriousError severity.
int countErrors() const;
2012-12-11 14:35:47 +00:00
};
}
#endif