1 | // Copyright (C) 2023 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // |
5 | // W A R N I N G |
6 | // ------------- |
7 | // |
8 | // This file is not part of the QtGraphs API. It exists purely as an |
9 | // implementation detail. This header file may change from version to |
10 | // version without notice, or even be removed. |
11 | // |
12 | // We mean it. |
13 | |
14 | #ifndef BARINSTANCING_H |
15 | #define BARINSTANCING_H |
16 | #include <QtGraphs/qgraphsglobal.h> |
17 | #include <private/qquick3dinstancing_p.h> |
18 | |
19 | struct BarItemHolder |
20 | { |
21 | QVector3D position = {.0f, .0f, .0f}; |
22 | QVector3D eulerRotation = {.0f, .0f, .0f}; |
23 | QVector3D scale = {.0f, .0f, .0f}; |
24 | QPoint coord; |
25 | float heightValue = .0f; |
26 | bool selectedBar = false; |
27 | QColor color = {0, 0, 0}; |
28 | ; |
29 | }; |
30 | |
31 | class Q_GRAPHS_EXPORT BarInstancing : public QQuick3DInstancing |
32 | { |
33 | Q_OBJECT |
34 | public: |
35 | BarInstancing(); |
36 | ~BarInstancing(); |
37 | |
38 | QList<BarItemHolder *> dataArray() const; |
39 | void setDataArray(const QList<BarItemHolder *> &newDataArray); |
40 | |
41 | void markDataDirty(); |
42 | bool transparency() const; |
43 | void setTransparency(bool newTransparencyValue); |
44 | |
45 | void clearDataArray(); |
46 | |
47 | protected: |
48 | QByteArray getInstanceBuffer(int *instanceCount) override; |
49 | |
50 | private: |
51 | QByteArray m_instanceData; |
52 | QList<BarItemHolder *> m_dataArray; |
53 | int m_instanceCount = 0; |
54 | bool m_dirty = true; |
55 | bool m_transparency = false; |
56 | }; |
57 | |
58 | #endif // BARINSTANCING_H |
59 |