1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QBARDATAPROXY_H |
5 | #define QBARDATAPROXY_H |
6 | |
7 | #include <QtDataVisualization/qabstractdataproxy.h> |
8 | #include <QtDataVisualization/qbardataitem.h> |
9 | #include <QtCore/QList> |
10 | #include <QtCore/QStringList> |
11 | |
12 | Q_MOC_INCLUDE(<QtDataVisualization/qbar3dseries.h>) |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | class QBarDataProxyPrivate; |
17 | class QBar3DSeries; |
18 | |
19 | typedef QList<QBarDataItem> QBarDataRow; |
20 | typedef QList<QBarDataRow *> QBarDataArray; |
21 | |
22 | class Q_DATAVISUALIZATION_EXPORT QBarDataProxy : public QAbstractDataProxy |
23 | { |
24 | Q_OBJECT |
25 | |
26 | Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged) |
27 | Q_PROPERTY(QStringList rowLabels READ rowLabels WRITE setRowLabels NOTIFY rowLabelsChanged) |
28 | Q_PROPERTY(QStringList columnLabels READ columnLabels WRITE setColumnLabels NOTIFY columnLabelsChanged) |
29 | Q_PROPERTY(QBar3DSeries *series READ series NOTIFY seriesChanged) |
30 | public: |
31 | explicit QBarDataProxy(QObject *parent = nullptr); |
32 | virtual ~QBarDataProxy(); |
33 | |
34 | QBar3DSeries *series() const; |
35 | int rowCount() const; |
36 | |
37 | QStringList rowLabels() const; |
38 | void setRowLabels(const QStringList &labels); |
39 | QStringList columnLabels() const; |
40 | void setColumnLabels(const QStringList &labels); |
41 | |
42 | const QBarDataArray *array() const; |
43 | const QBarDataRow *rowAt(int rowIndex) const; |
44 | const QBarDataItem *itemAt(int rowIndex, int columnIndex) const; |
45 | const QBarDataItem *itemAt(const QPoint &position) const; |
46 | |
47 | void resetArray(); |
48 | void resetArray(QBarDataArray *newArray); |
49 | void resetArray(QBarDataArray *newArray, const QStringList &rowLabels, |
50 | const QStringList &columnLabels); |
51 | |
52 | void setRow(int rowIndex, QBarDataRow *row); |
53 | void setRow(int rowIndex, QBarDataRow *row, const QString &label); |
54 | void setRows(int rowIndex, const QBarDataArray &rows); |
55 | void setRows(int rowIndex, const QBarDataArray &rows, const QStringList &labels); |
56 | |
57 | void setItem(int rowIndex, int columnIndex, const QBarDataItem &item); |
58 | void setItem(const QPoint &position, const QBarDataItem &item); |
59 | |
60 | int addRow(QBarDataRow *row); |
61 | int addRow(QBarDataRow *row, const QString &label); |
62 | int addRows(const QBarDataArray &rows); |
63 | int addRows(const QBarDataArray &rows, const QStringList &labels); |
64 | |
65 | void insertRow(int rowIndex, QBarDataRow *row); |
66 | void insertRow(int rowIndex, QBarDataRow *row, const QString &label); |
67 | void insertRows(int rowIndex, const QBarDataArray &rows); |
68 | void insertRows(int rowIndex, const QBarDataArray &rows, const QStringList &labels); |
69 | |
70 | void removeRows(int rowIndex, int removeCount, bool removeLabels = true); |
71 | |
72 | Q_SIGNALS: |
73 | void arrayReset(); |
74 | void rowsAdded(int startIndex, int count); |
75 | void rowsChanged(int startIndex, int count); |
76 | void rowsRemoved(int startIndex, int count); |
77 | void rowsInserted(int startIndex, int count); |
78 | void itemChanged(int rowIndex, int columnIndex); |
79 | |
80 | void rowCountChanged(int count); |
81 | void rowLabelsChanged(); |
82 | void columnLabelsChanged(); |
83 | void seriesChanged(QBar3DSeries *series); |
84 | |
85 | protected: |
86 | explicit QBarDataProxy(QBarDataProxyPrivate *d, QObject *parent = nullptr); |
87 | QBarDataProxyPrivate *dptr(); |
88 | const QBarDataProxyPrivate *dptrc() const; |
89 | |
90 | private: |
91 | Q_DISABLE_COPY(QBarDataProxy) |
92 | |
93 | friend class Bars3DController; |
94 | }; |
95 | |
96 | QT_END_NAMESPACE |
97 | |
98 | #endif |
99 | |