1// Copyright (C) 2016 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 QtDataVisualization 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 DECLARATIVEBARS_P_H
15#define DECLARATIVEBARS_P_H
16
17#include "abstractdeclarative_p.h"
18
19#include <private/datavisualizationglobal_p.h>
20#include <private/bars3dcontroller_p.h>
21
22QT_BEGIN_NAMESPACE
23class DeclarativeBars : public AbstractDeclarative
24{
25 Q_OBJECT
26 Q_PROPERTY(QCategory3DAxis *rowAxis READ rowAxis WRITE setRowAxis NOTIFY rowAxisChanged)
27 Q_PROPERTY(QValue3DAxis *valueAxis READ valueAxis WRITE setValueAxis NOTIFY valueAxisChanged)
28 Q_PROPERTY(QCategory3DAxis *columnAxis READ columnAxis WRITE setColumnAxis NOTIFY columnAxisChanged)
29 Q_PROPERTY(bool multiSeriesUniform READ isMultiSeriesUniform WRITE setMultiSeriesUniform NOTIFY multiSeriesUniformChanged)
30 Q_PROPERTY(float barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged)
31 Q_PROPERTY(QSizeF barSpacing READ barSpacing WRITE setBarSpacing NOTIFY barSpacingChanged)
32 Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged)
33 Q_PROPERTY(QSizeF barSeriesMargin READ barSeriesMargin WRITE setBarSeriesMargin NOTIFY barSeriesMarginChanged REVISION(6, 3))
34 Q_PROPERTY(QQmlListProperty<QBar3DSeries> seriesList READ seriesList)
35 Q_PROPERTY(QBar3DSeries *selectedSeries READ selectedSeries NOTIFY selectedSeriesChanged)
36 Q_PROPERTY(QBar3DSeries *primarySeries READ primarySeries WRITE setPrimarySeries NOTIFY primarySeriesChanged)
37 Q_PROPERTY(float floorLevel READ floorLevel WRITE setFloorLevel NOTIFY floorLevelChanged REVISION(1, 2))
38 Q_CLASSINFO("DefaultProperty", "seriesList")
39
40 QML_NAMED_ELEMENT(Bars3D)
41 QML_ADDED_IN_VERSION(1, 0)
42
43public:
44 explicit DeclarativeBars(QQuickItem *parent = 0);
45 ~DeclarativeBars();
46
47 QCategory3DAxis *rowAxis() const;
48 void setRowAxis(QCategory3DAxis *axis);
49 QValue3DAxis *valueAxis() const;
50 void setValueAxis(QValue3DAxis *axis);
51 QCategory3DAxis *columnAxis() const;
52 void setColumnAxis(QCategory3DAxis *axis);
53
54 void setMultiSeriesUniform(bool uniform);
55 bool isMultiSeriesUniform() const;
56
57 void setBarThickness(float thicknessRatio);
58 float barThickness() const;
59
60 void setBarSpacing(const QSizeF &spacing);
61 QSizeF barSpacing() const;
62
63 void setBarSpacingRelative(bool relative);
64 bool isBarSpacingRelative() const;
65
66 void setBarSeriesMargin(const QSizeF &margin);
67 QSizeF barSeriesMargin() const;
68
69 QQmlListProperty<QBar3DSeries> seriesList();
70 static void appendSeriesFunc(QQmlListProperty<QBar3DSeries> *list, QBar3DSeries *series);
71 static qsizetype countSeriesFunc(QQmlListProperty<QBar3DSeries> *list);
72 static QBar3DSeries *atSeriesFunc(QQmlListProperty<QBar3DSeries> *list, qsizetype index);
73 static void clearSeriesFunc(QQmlListProperty<QBar3DSeries> *list);
74 Q_INVOKABLE void addSeries(QBar3DSeries *series);
75 Q_INVOKABLE void removeSeries(QBar3DSeries *series);
76 Q_INVOKABLE void insertSeries(int index, QBar3DSeries *series);
77 void setPrimarySeries(QBar3DSeries *series);
78 QBar3DSeries *primarySeries() const;
79 QBar3DSeries *selectedSeries() const;
80
81 void setFloorLevel(float level);
82 float floorLevel() const;
83
84public Q_SLOTS:
85 void handleAxisXChanged(QAbstract3DAxis *axis) override;
86 void handleAxisYChanged(QAbstract3DAxis *axis) override;
87 void handleAxisZChanged(QAbstract3DAxis *axis) override;
88
89Q_SIGNALS:
90 void rowAxisChanged(QCategory3DAxis *axis);
91 void valueAxisChanged(QValue3DAxis *axis);
92 void columnAxisChanged(QCategory3DAxis *axis);
93 void multiSeriesUniformChanged(bool uniform);
94 void barThicknessChanged(float thicknessRatio);
95 void barSpacingChanged(const QSizeF &spacing);
96 void barSpacingRelativeChanged(bool relative);
97 Q_REVISION(6, 3) void barSeriesMarginChanged(const QSizeF &margin);
98 void meshFileNameChanged(const QString &filename);
99 void primarySeriesChanged(QBar3DSeries *series);
100 void selectedSeriesChanged(QBar3DSeries *series);
101 Q_REVISION(1, 2) void floorLevelChanged(float level);
102
103private:
104 Bars3DController *m_barsController;
105};
106
107QT_END_NAMESPACE
108
109#endif
110

source code of qtdatavis3d/src/datavisualizationqml/declarativebars_p.h