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
10Q_MOC_INCLUDE(<QtGraphs/qsurface3dseries.h>)
11
12QT_BEGIN_NAMESPACE
13
14class QSurfaceDataProxyPrivate;
15class QSurface3DSeries;
16
17using QSurfaceDataRow = QList<QSurfaceDataItem>;
18using QSurfaceDataArray = QList<QSurfaceDataRow *>;
19
20class Q_GRAPHS_EXPORT QSurfaceDataProxy : public QAbstractDataProxy
21{
22 Q_OBJECT
23 Q_DECLARE_PRIVATE(QSurfaceDataProxy)
24 Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged)
25 Q_PROPERTY(int columnCount READ columnCount NOTIFY columnCountChanged)
26 Q_PROPERTY(QSurface3DSeries *series READ series NOTIFY seriesChanged)
27
28public:
29 explicit QSurfaceDataProxy(QObject *parent = nullptr);
30 virtual ~QSurfaceDataProxy();
31
32 QSurface3DSeries *series() const;
33 int rowCount() const;
34 int columnCount() const;
35 const QSurfaceDataArray *array() const;
36 const QSurfaceDataItem *itemAt(int rowIndex, int columnIndex) const;
37 const QSurfaceDataItem *itemAt(const QPoint &position) const;
38
39 void resetArray(QSurfaceDataArray *newArray);
40
41 void setRow(int rowIndex, QSurfaceDataRow *row);
42 void setRows(int rowIndex, const QSurfaceDataArray &rows);
43
44 void setItem(int rowIndex, int columnIndex, const QSurfaceDataItem &item);
45 void setItem(const QPoint &position, const QSurfaceDataItem &item);
46
47 int addRow(QSurfaceDataRow *row);
48 int addRows(const QSurfaceDataArray &rows);
49
50 void insertRow(int rowIndex, QSurfaceDataRow *row);
51 void insertRows(int rowIndex, const QSurfaceDataArray &rows);
52
53 void removeRows(int rowIndex, int removeCount);
54
55Q_SIGNALS:
56 void arrayReset();
57 void rowsAdded(int startIndex, int count);
58 void rowsChanged(int startIndex, int count);
59 void rowsRemoved(int startIndex, int count);
60 void rowsInserted(int startIndex, int count);
61 void itemChanged(int rowIndex, int columnIndex);
62
63 void rowCountChanged(int count);
64 void columnCountChanged(int count);
65 void seriesChanged(QSurface3DSeries *series);
66
67protected:
68 explicit QSurfaceDataProxy(QSurfaceDataProxyPrivate *d, QObject *parent = nullptr);
69
70private:
71 Q_DISABLE_COPY(QSurfaceDataProxy)
72
73 friend class Surface3DController;
74};
75
76QT_END_NAMESPACE
77
78#endif
79

source code of qtgraphs/src/graphs/data/qsurfacedataproxy.h