1 | // Copyright (C) 2023 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QSURFACEDATAPROXY_H |
5 | #define QSURFACEDATAPROXY_H |
6 | |
7 | #include <QtGraphs/qabstractdataproxy.h> |
8 | #include <QtGraphs/qsurfacedataitem.h> |
9 | |
10 | Q_MOC_INCLUDE(<QtGraphs/qsurface3dseries.h>) |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class QSurfaceDataProxyPrivate; |
15 | class QSurface3DSeries; |
16 | |
17 | using QSurfaceDataRow = QList<QSurfaceDataItem>; |
18 | using QSurfaceDataArray = QList<QSurfaceDataRow>; |
19 | |
20 | class Q_GRAPHS_EXPORT QSurfaceDataProxy : public QAbstractDataProxy |
21 | { |
22 | Q_OBJECT |
23 | Q_DECLARE_PRIVATE(QSurfaceDataProxy) |
24 | Q_PROPERTY(qsizetype rowCount READ rowCount NOTIFY rowCountChanged FINAL) |
25 | Q_PROPERTY(qsizetype columnCount READ columnCount NOTIFY columnCountChanged FINAL) |
26 | Q_PROPERTY(QSurface3DSeries *series READ series NOTIFY seriesChanged FINAL) |
27 | |
28 | public: |
29 | explicit QSurfaceDataProxy(QObject *parent = nullptr); |
30 | ~QSurfaceDataProxy() override; |
31 | |
32 | QSurface3DSeries *series() const; |
33 | qsizetype rowCount() const; |
34 | qsizetype columnCount() const; |
35 | const QSurfaceDataItem &itemAt(qsizetype rowIndex, qsizetype columnIndex) const; |
36 | const QSurfaceDataItem &itemAt(QPoint position) const; |
37 | |
38 | void resetArray(); |
39 | void resetArray(QSurfaceDataArray newArray); |
40 | |
41 | void setRow(qsizetype rowIndex, QSurfaceDataRow row); |
42 | void setRows(qsizetype rowIndex, QSurfaceDataArray rows); |
43 | |
44 | void setItem(qsizetype rowIndex, qsizetype columnIndex, QSurfaceDataItem item); |
45 | void setItem(QPoint position, QSurfaceDataItem item); |
46 | |
47 | qsizetype addRow(QSurfaceDataRow row); |
48 | qsizetype addRows(QSurfaceDataArray rows); |
49 | |
50 | void insertRow(qsizetype rowIndex, QSurfaceDataRow row); |
51 | void insertRows(qsizetype rowIndex, QSurfaceDataArray rows); |
52 | |
53 | void removeRows(qsizetype rowIndex, qsizetype removeCount); |
54 | |
55 | Q_SIGNALS: |
56 | void arrayReset(); |
57 | void rowsAdded(qsizetype startIndex, qsizetype count); |
58 | void rowsChanged(qsizetype startIndex, qsizetype count); |
59 | void rowsRemoved(qsizetype startIndex, qsizetype count); |
60 | void rowsInserted(qsizetype startIndex, qsizetype count); |
61 | void itemChanged(qsizetype rowIndex, qsizetype columnIndex); |
62 | |
63 | void rowCountChanged(qsizetype count); |
64 | void columnCountChanged(qsizetype count); |
65 | void seriesChanged(QSurface3DSeries *series); |
66 | |
67 | protected: |
68 | explicit QSurfaceDataProxy(QSurfaceDataProxyPrivate &d, QObject *parent = nullptr); |
69 | |
70 | private: |
71 | Q_DISABLE_COPY(QSurfaceDataProxy) |
72 | |
73 | friend class QQuickGraphsSurface; |
74 | }; |
75 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif |
79 | |