1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSCATTERDATAPROXY_H
5#define QSCATTERDATAPROXY_H
6
7#include <QtGraphs/qabstractdataproxy.h>
8#include <QtGraphs/qscatterdataitem.h>
9
10Q_MOC_INCLUDE(<QtGraphs/qscatter3dseries.h>)
11
12QT_BEGIN_NAMESPACE
13
14class QScatterDataProxyPrivate;
15class QScatter3DSeries;
16
17using QScatterDataArray = QList<QScatterDataItem>;
18
19class Q_GRAPHS_EXPORT QScatterDataProxy : public QAbstractDataProxy
20{
21 Q_OBJECT
22 Q_DECLARE_PRIVATE(QScatterDataProxy)
23 Q_PROPERTY(int itemCount READ itemCount NOTIFY itemCountChanged)
24 Q_PROPERTY(QScatter3DSeries *series READ series NOTIFY seriesChanged)
25
26public:
27 explicit QScatterDataProxy(QObject *parent = nullptr);
28 virtual ~QScatterDataProxy();
29
30 QScatter3DSeries *series() const;
31 int itemCount() const;
32 const QScatterDataArray *array() const;
33 const QScatterDataItem *itemAt(int index) const;
34
35 void resetArray(QScatterDataArray *newArray);
36
37 void setItem(int index, const QScatterDataItem &item);
38 void setItems(int index, const QScatterDataArray &items);
39
40 int addItem(const QScatterDataItem &item);
41 int addItems(const QScatterDataArray &items);
42
43 void insertItem(int index, const QScatterDataItem &item);
44 void insertItems(int index, const QScatterDataArray &items);
45
46 void removeItems(int index, int removeCount);
47
48Q_SIGNALS:
49 void arrayReset();
50 void itemsAdded(int startIndex, int count);
51 void itemsChanged(int startIndex, int count);
52 void itemsRemoved(int startIndex, int count);
53 void itemsInserted(int startIndex, int count);
54
55 void itemCountChanged(int count);
56 void seriesChanged(QScatter3DSeries *series);
57
58protected:
59 explicit QScatterDataProxy(QScatterDataProxyPrivate *d, QObject *parent = nullptr);
60
61private:
62 Q_DISABLE_COPY(QScatterDataProxy)
63
64 friend class Scatter3DController;
65};
66
67QT_END_NAMESPACE
68
69#endif
70

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