Debian Codegraph @

tests/manual/boxplottester/customtablemodel.h

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #ifndef CUSTOMTABLEMODEL_H
5 #define CUSTOMTABLEMODEL_H
6
7 #include <QtCore/QAbstractTableModel>
8 #include <QtCore/QMultiHash>
9 #include <QtCore/QRect>
10
11 class CustomTableModel : public QAbstractTableModel
12 {
13 Q_OBJECT
14 public:
15 explicit CustomTableModel(QObject *parent = 0);
16 virtual ~CustomTableModel();
17
18 int rowCount(const QModelIndex &parent = QModelIndex()) const;
19 int columnCount(const QModelIndex &parent = QModelIndex()) const;
20 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
21 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
22 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
23 Qt::ItemFlags flags(const QModelIndex &index) const;
24
25 void addMapping(QString color, QRect area);
26 void clearMapping() { m_mapping.clear(); }
27
28 private:
29 QList<QList<qreal> *> m_data;
30 QMultiHash<QString, QRect> m_mapping;
31 int m_columnCount;
32 int m_rowCount;
33 };
34
35 #endif // CUSTOMTABLEMODEL_H