Debian Codegraph @

tests/manual/candlesticktester/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 <QtCharts/QChartGlobal>
8 #include <QtCore/QAbstractTableModel>
9 #include <QtCore/QHash>
10 #include <QtCore/QRect>
11
12 QT_BEGIN_NAMESPACE
13 class QCandlestickSet;
14 QT_END_NAMESPACE
15
16 QT_USE_NAMESPACE
17
18 class CustomTableModel : public QAbstractTableModel
19 {
20 Q_OBJECT
21
22 public:
23 explicit CustomTableModel(QObject *parent = nullptr);
24 virtual ~CustomTableModel();
25
26 int rowCount(const QModelIndex &parent = QModelIndex()) const;
27 int columnCount(const QModelIndex &parent = QModelIndex()) const;
28 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
29 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
30 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
31 Qt::ItemFlags flags(const QModelIndex &index) const;
32 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
33 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
34
35 void addRow(QCandlestickSet *set);
36 void clearRows();
37
38 void addMapping(QString color, QRect area);
39 void clearMapping();
40
41 private:
42 QStringList m_categories;
43 QList<QList<qreal> *> m_data;
44 QMultiHash<QString, QRect> m_mapping;
45 };
46
47 #endif // CUSTOMTABLEMODEL_H