1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QTGRAPHS_QVALUE3DAXIS_H
5#define QTGRAPHS_QVALUE3DAXIS_H
6
7#include <QtGraphs/qabstract3daxis.h>
8#include <QtGraphs/qvalue3daxisformatter.h>
9
10QT_BEGIN_NAMESPACE
11
12class QValue3DAxisPrivate;
13
14class Q_GRAPHS_EXPORT QValue3DAxis : public QAbstract3DAxis
15{
16 Q_OBJECT
17 Q_DECLARE_PRIVATE(QValue3DAxis)
18 Q_PROPERTY(qsizetype segmentCount READ segmentCount WRITE setSegmentCount NOTIFY
19 segmentCountChanged FINAL)
20 Q_PROPERTY(qsizetype subSegmentCount READ subSegmentCount WRITE setSubSegmentCount NOTIFY
21 subSegmentCountChanged FINAL)
22 Q_PROPERTY(
23 QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged FINAL)
24 Q_PROPERTY(QValue3DAxisFormatter *formatter READ formatter WRITE setFormatter NOTIFY
25 formatterChanged FINAL)
26 Q_PROPERTY(bool reversed READ reversed WRITE setReversed NOTIFY reversedChanged FINAL)
27 QML_NAMED_ELEMENT(Value3DAxis)
28
29public:
30 explicit QValue3DAxis(QObject *parent = nullptr);
31 ~QValue3DAxis() override;
32
33 void setSegmentCount(qsizetype count);
34 qsizetype segmentCount() const;
35
36 void setSubSegmentCount(qsizetype count);
37 qsizetype subSegmentCount() const;
38
39 void setLabelFormat(const QString &format);
40 QString labelFormat() const;
41
42 void setFormatter(QValue3DAxisFormatter *formatter);
43 QValue3DAxisFormatter *formatter() const;
44
45 void setReversed(bool enable);
46 bool reversed() const;
47
48 void recalculate();
49 qsizetype gridSize();
50 qsizetype subGridSize();
51 float gridPositionAt(qsizetype gridLine);
52 float subGridPositionAt(qsizetype gridLine);
53 float labelPositionAt(qsizetype index);
54 float positionAt(float x);
55 QString stringForValue(float x);
56
57Q_SIGNALS:
58 void segmentCountChanged(qsizetype count);
59 void subSegmentCountChanged(qsizetype count);
60 void labelFormatChanged(const QString &format);
61 void formatterChanged(QValue3DAxisFormatter *formatter);
62 void reversedChanged(bool enable);
63 void formatterDirty();
64
65private:
66 Q_DISABLE_COPY(QValue3DAxis)
67 friend class QQuickGraphsItem;
68 friend class QQuickGraphsBars;
69 friend class QQuickGraphsScatter;
70 friend class QQuickGraphsSurface;
71 friend class QValue3DAxisFormatterPrivate;
72};
73
74QT_END_NAMESPACE
75
76#endif
77

source code of qtgraphs/src/graphs3d/axis/qvalue3daxis.h