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
19struct 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
31class Q_GRAPHS_EXPORT BarInstancing : public QQuick3DInstancing
32{
33 Q_OBJECT
34public:
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
47protected:
48 QByteArray getInstanceBuffer(int *instanceCount) override;
49
50private:
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

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtgraphs/src/graphs3d/engine/barinstancing_p.h