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 QABSTRACT3DAXIS_H
31#define QABSTRACT3DAXIS_H
32
33#include <QtDataVisualization/qdatavisualizationglobal.h>
34#include <QtCore/QObject>
35#include <QtCore/QScopedPointer>
36#include <QtCore/QStringList>
37
38QT_BEGIN_NAMESPACE_DATAVISUALIZATION
39
40class QAbstract3DAxisPrivate;
41
42class QT_DATAVISUALIZATION_EXPORT QAbstract3DAxis : public QObject
43{
44 Q_OBJECT
45 Q_ENUMS(AxisOrientation)
46 Q_ENUMS(AxisType)
47 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
48 Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged)
49 Q_PROPERTY(AxisOrientation orientation READ orientation NOTIFY orientationChanged)
50 Q_PROPERTY(AxisType type READ type CONSTANT)
51 Q_PROPERTY(float min READ min WRITE setMin NOTIFY minChanged)
52 Q_PROPERTY(float max READ max WRITE setMax NOTIFY maxChanged)
53 Q_PROPERTY(bool autoAdjustRange READ isAutoAdjustRange WRITE setAutoAdjustRange NOTIFY autoAdjustRangeChanged)
54 Q_PROPERTY(float labelAutoRotation READ labelAutoRotation WRITE setLabelAutoRotation NOTIFY labelAutoRotationChanged REVISION 1)
55 Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibilityChanged REVISION 1)
56 Q_PROPERTY(bool titleFixed READ isTitleFixed WRITE setTitleFixed NOTIFY titleFixedChanged REVISION 1)
57
58public:
59 enum AxisOrientation {
60 AxisOrientationNone = 0,
61 AxisOrientationX = 1,
62 AxisOrientationY = 2,
63 AxisOrientationZ = 4
64 };
65
66 enum AxisType {
67 AxisTypeNone = 0,
68 AxisTypeCategory = 1,
69 AxisTypeValue = 2
70 };
71
72protected:
73 explicit QAbstract3DAxis(QAbstract3DAxisPrivate *d, QObject *parent = nullptr);
74
75public:
76 virtual ~QAbstract3DAxis();
77
78 void setTitle(const QString &title);
79 QString title() const;
80
81 void setLabels(const QStringList &labels);
82 QStringList labels() const;
83
84 AxisOrientation orientation() const;
85 AxisType type() const;
86
87 void setMin(float min);
88 float min() const;
89
90 void setMax(float max);
91 float max() const;
92
93 void setAutoAdjustRange(bool autoAdjust);
94 bool isAutoAdjustRange() const;
95
96 void setRange(float min, float max);
97
98 void setLabelAutoRotation(float angle);
99 float labelAutoRotation() const;
100
101 void setTitleVisible(bool visible);
102 bool isTitleVisible() const;
103
104 void setTitleFixed(bool fixed);
105 bool isTitleFixed() const;
106
107Q_SIGNALS:
108 void titleChanged(const QString &newTitle);
109 void labelsChanged();
110 void orientationChanged(QAbstract3DAxis::AxisOrientation orientation);
111 void minChanged(float value);
112 void maxChanged(float value);
113 void rangeChanged(float min, float max);
114 void autoAdjustRangeChanged(bool autoAdjust);
115 Q_REVISION(1) void labelAutoRotationChanged(float angle);
116 Q_REVISION(1) void titleVisibilityChanged(bool visible);
117 Q_REVISION(1) void titleFixedChanged(bool fixed);
118
119protected:
120 QScopedPointer<QAbstract3DAxisPrivate> d_ptr;
121
122private:
123 Q_DISABLE_COPY(QAbstract3DAxis)
124
125 friend class Abstract3DController;
126 friend class Bars3DController;
127 friend class QScatterDataProxyPrivate;
128 friend class QSurfaceDataProxyPrivate;
129};
130
131QT_END_NAMESPACE_DATAVISUALIZATION
132
133#endif
134