File indexing completed on 2024-12-15 03:45:01
0001 /* 0002 SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #ifndef KUSERFEEDBACK_CONSOLE_RATIOSETAGGREGATIONMODEL_H 0008 #define KUSERFEEDBACK_CONSOLE_RATIOSETAGGREGATIONMODEL_H 0009 0010 #include <QAbstractTableModel> 0011 0012 namespace KUserFeedback { 0013 namespace Console { 0014 0015 class RatioSetAggregationModel : public QAbstractTableModel 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit RatioSetAggregationModel(QObject *parent = nullptr); 0020 ~RatioSetAggregationModel() override; 0021 0022 void setSourceModel(QAbstractItemModel *model); 0023 void setAggregationValue(const QString &aggrValue); 0024 0025 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0026 int columnCount(const QModelIndex &parent = QModelIndex()) const override; 0027 QVariant data(const QModelIndex &index, int role) const override; 0028 QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0029 0030 private: 0031 void recompute(); 0032 0033 QAbstractItemModel *m_sourceModel = nullptr; 0034 QString m_aggrValue; 0035 QVector<QString> m_categories; 0036 double *m_data = nullptr; 0037 }; 0038 0039 } 0040 } 0041 0042 #endif // KUSERFEEDBACK_CONSOLE_RATIOSETAGGREGATIONMODEL_H