1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef Q3DBARS_H
31#define Q3DBARS_H
32
33#include <QtDataVisualization/qabstract3dgraph.h>
34#include <QtDataVisualization/qvalue3daxis.h>
35#include <QtDataVisualization/qcategory3daxis.h>
36#include <QtDataVisualization/qbar3dseries.h>
37
38QT_BEGIN_NAMESPACE_DATAVISUALIZATION
39
40class Q3DBarsPrivate;
41
42class QT_DATAVISUALIZATION_EXPORT Q3DBars : public QAbstract3DGraph
43{
44 Q_OBJECT
45 Q_PROPERTY(bool multiSeriesUniform READ isMultiSeriesUniform WRITE setMultiSeriesUniform NOTIFY multiSeriesUniformChanged)
46 Q_PROPERTY(float barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged)
47 Q_PROPERTY(QSizeF barSpacing READ barSpacing WRITE setBarSpacing NOTIFY barSpacingChanged)
48 Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged)
49 Q_PROPERTY(QCategory3DAxis *rowAxis READ rowAxis WRITE setRowAxis NOTIFY rowAxisChanged)
50 Q_PROPERTY(QCategory3DAxis *columnAxis READ columnAxis WRITE setColumnAxis NOTIFY columnAxisChanged)
51 Q_PROPERTY(QValue3DAxis *valueAxis READ valueAxis WRITE setValueAxis NOTIFY valueAxisChanged)
52 Q_PROPERTY(QBar3DSeries *primarySeries READ primarySeries WRITE setPrimarySeries NOTIFY primarySeriesChanged)
53 Q_PROPERTY(QBar3DSeries *selectedSeries READ selectedSeries NOTIFY selectedSeriesChanged)
54 Q_PROPERTY(float floorLevel READ floorLevel WRITE setFloorLevel NOTIFY floorLevelChanged)
55
56public:
57 explicit Q3DBars(const QSurfaceFormat *format = nullptr, QWindow *parent = nullptr);
58 virtual ~Q3DBars();
59
60 void setPrimarySeries(QBar3DSeries *series);
61 QBar3DSeries *primarySeries() const;
62 void addSeries(QBar3DSeries *series);
63 void removeSeries(QBar3DSeries *series);
64 void insertSeries(int index, QBar3DSeries *series);
65 QList<QBar3DSeries *> seriesList() const;
66
67 void setMultiSeriesUniform(bool uniform);
68 bool isMultiSeriesUniform() const;
69
70 void setBarThickness(float thicknessRatio);
71 float barThickness() const;
72
73 void setBarSpacing(const QSizeF &spacing);
74 QSizeF barSpacing() const;
75
76 void setBarSpacingRelative(bool relative);
77 bool isBarSpacingRelative() const;
78
79 void setRowAxis(QCategory3DAxis *axis);
80 QCategory3DAxis *rowAxis() const;
81 void setColumnAxis(QCategory3DAxis *axis);
82 QCategory3DAxis *columnAxis() const;
83 void setValueAxis(QValue3DAxis *axis);
84 QValue3DAxis *valueAxis() const;
85 void addAxis(QAbstract3DAxis *axis);
86 void releaseAxis(QAbstract3DAxis *axis);
87 QList<QAbstract3DAxis *> axes() const;
88
89 QBar3DSeries *selectedSeries() const;
90 void setFloorLevel(float level);
91 float floorLevel() const;
92
93Q_SIGNALS:
94 void multiSeriesUniformChanged(bool uniform);
95 void barThicknessChanged(float thicknessRatio);
96 void barSpacingChanged(const QSizeF &spacing);
97 void barSpacingRelativeChanged(bool relative);
98 void rowAxisChanged(QCategory3DAxis *axis);
99 void columnAxisChanged(QCategory3DAxis *axis);
100 void valueAxisChanged(QValue3DAxis *axis);
101 void primarySeriesChanged(QBar3DSeries *series);
102 void selectedSeriesChanged(QBar3DSeries *series);
103 void floorLevelChanged(float level);
104
105private:
106 Q3DBarsPrivate *dptr();
107 const Q3DBarsPrivate *dptrc() const;
108 Q_DISABLE_COPY(Q3DBars)
109};
110
111QT_END_NAMESPACE_DATAVISUALIZATION
112
113#endif
114