ErrorReportTableModel.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef ERRORREPORTTABLEMODEL_H
  9. #define ERRORREPORTTABLEMODEL_H
  10. #if !defined(Q_MOC_RUN)
  11. #include "Util/AbstractSortModel.h"
  12. #include <QMetaType>
  13. #include <QPixmap>
  14. #endif
  15. class CErrorReport;
  16. class CErrorRecord;
  17. bool GetPositionFromString(QString er, float* x, float* y, float* z);
  18. class CErrorReportTableModel
  19. : public AbstractSortModel
  20. {
  21. Q_OBJECT
  22. public:
  23. enum Column
  24. {
  25. ColumnSeverity,
  26. ColumnCount,
  27. ColumnText,
  28. ColumnFile,
  29. ColumnObject,
  30. ColumnModule,
  31. ColumnDescription,
  32. ColumnAssetScope
  33. };
  34. enum Roles
  35. {
  36. SeverityRole = Qt::UserRole + 1
  37. };
  38. CErrorReportTableModel(QObject* parent = 0);
  39. ~CErrorReportTableModel();
  40. void setErrorReport(CErrorReport* report);
  41. int rowCount(const QModelIndex& parent = QModelIndex()) const override;
  42. int columnCount(const QModelIndex& parent = QModelIndex()) const override;
  43. QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
  44. QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
  45. bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role = Qt::EditRole) override;
  46. bool LessThan(const QModelIndex& lhs, const QModelIndex& rhs) const override;
  47. protected:
  48. QVariant data(const CErrorRecord& record, int column, int role = Qt::DisplayRole) const;
  49. private:
  50. QHash<int, int> m_alignments;
  51. std::vector<CErrorRecord> m_errorRecords;
  52. QVector<QIcon> m_imageList;
  53. };
  54. Q_DECLARE_METATYPE(const CErrorRecord*)
  55. #endif