1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef Q3DBARS_H
5#define Q3DBARS_H
6
7#include <QtDataVisualization/qabstract3dgraph.h>
8#include <QtDataVisualization/qvalue3daxis.h>
9#include <QtDataVisualization/qcategory3daxis.h>
10#include <QtDataVisualization/qbar3dseries.h>
11
12QT_BEGIN_NAMESPACE
13
14class Q3DBarsPrivate;
15
16class Q_DATAVISUALIZATION_EXPORT Q3DBars : public QAbstract3DGraph
17{
18 Q_OBJECT
19 Q_PROPERTY(bool multiSeriesUniform READ isMultiSeriesUniform WRITE setMultiSeriesUniform NOTIFY multiSeriesUniformChanged)
20 Q_PROPERTY(float barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged)
21 Q_PROPERTY(QSizeF barSpacing READ barSpacing WRITE setBarSpacing NOTIFY barSpacingChanged)
22 Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged)
23 Q_PROPERTY(QSizeF barSeriesMargin READ barSeriesMargin WRITE setBarSeriesMargin NOTIFY barSeriesMarginChanged REVISION(6, 3))
24 Q_PROPERTY(QCategory3DAxis *rowAxis READ rowAxis WRITE setRowAxis NOTIFY rowAxisChanged)
25 Q_PROPERTY(QCategory3DAxis *columnAxis READ columnAxis WRITE setColumnAxis NOTIFY columnAxisChanged)
26 Q_PROPERTY(QValue3DAxis *valueAxis READ valueAxis WRITE setValueAxis NOTIFY valueAxisChanged)
27 Q_PROPERTY(QBar3DSeries *primarySeries READ primarySeries WRITE setPrimarySeries NOTIFY primarySeriesChanged)
28 Q_PROPERTY(QBar3DSeries *selectedSeries READ selectedSeries NOTIFY selectedSeriesChanged)
29 Q_PROPERTY(float floorLevel READ floorLevel WRITE setFloorLevel NOTIFY floorLevelChanged)
30
31public:
32 explicit Q3DBars(const QSurfaceFormat *format = nullptr, QWindow *parent = nullptr);
33 virtual ~Q3DBars();
34
35 void setPrimarySeries(QBar3DSeries *series);
36 QBar3DSeries *primarySeries() const;
37 void addSeries(QBar3DSeries *series);
38 void removeSeries(QBar3DSeries *series);
39 void insertSeries(int index, QBar3DSeries *series);
40 QList<QBar3DSeries *> seriesList() const;
41
42 void setMultiSeriesUniform(bool uniform);
43 bool isMultiSeriesUniform() const;
44
45 void setBarThickness(float thicknessRatio);
46 float barThickness() const;
47
48 void setBarSpacing(const QSizeF &spacing);
49 QSizeF barSpacing() const;
50
51 void setBarSpacingRelative(bool relative);
52 bool isBarSpacingRelative() const;
53
54 void setBarSeriesMargin(const QSizeF &margin);
55 QSizeF barSeriesMargin() const;
56
57 void setRowAxis(QCategory3DAxis *axis);
58 QCategory3DAxis *rowAxis() const;
59 void setColumnAxis(QCategory3DAxis *axis);
60 QCategory3DAxis *columnAxis() const;
61 void setValueAxis(QValue3DAxis *axis);
62 QValue3DAxis *valueAxis() const;
63 void addAxis(QAbstract3DAxis *axis);
64 void releaseAxis(QAbstract3DAxis *axis);
65 QList<QAbstract3DAxis *> axes() const;
66
67 QBar3DSeries *selectedSeries() const;
68 void setFloorLevel(float level);
69 float floorLevel() const;
70
71Q_SIGNALS:
72 void multiSeriesUniformChanged(bool uniform);
73 void barThicknessChanged(float thicknessRatio);
74 void barSpacingChanged(const QSizeF &spacing);
75 void barSpacingRelativeChanged(bool relative);
76 Q_REVISION(6, 3) void barSeriesMarginChanged(const QSizeF &margin);
77 void rowAxisChanged(QCategory3DAxis *axis);
78 void columnAxisChanged(QCategory3DAxis *axis);
79 void valueAxisChanged(QValue3DAxis *axis);
80 void primarySeriesChanged(QBar3DSeries *series);
81 void selectedSeriesChanged(QBar3DSeries *series);
82 void floorLevelChanged(float level);
83
84private:
85 Q3DBarsPrivate *dptr();
86 const Q3DBarsPrivate *dptrc() const;
87 Q_DISABLE_COPY(Q3DBars)
88};
89
90QT_END_NAMESPACE
91
92#endif
93

source code of qtdatavis3d/src/datavisualization/engine/q3dbars.h