| 1 | // Copyright (C) 2025 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 QtGraphs 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 QQUICKGRAPHSSURFACENODE_P_H |
| 15 | #define QQUICKGRAPHSSURFACENODE_P_H |
| 16 | |
| 17 | #include "qquickgraphsnode_p.h" |
| 18 | #include "qquickgraphssurface_p.h" |
| 19 | #include "qsurface3dseries.h" |
| 20 | |
| 21 | #include <private/qgraphsglobal_p.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class QQuickGraphsSurfaceNode; |
| 26 | |
| 27 | class Q_GRAPHS_EXPORT QQuickGraphsSurfaceNode : public QQuickGraphsNode |
| 28 | { |
| 29 | Q_OBJECT |
| 30 | Q_PROPERTY(QValue3DAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) |
| 31 | Q_PROPERTY(QValue3DAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) |
| 32 | Q_PROPERTY(QValue3DAxis *axisZ READ axisZ WRITE setAxisZ NOTIFY axisZChanged) |
| 33 | Q_PROPERTY(QSurface3DSeries *selectedSeries READ selectedSeries NOTIFY selectedSeriesChanged) |
| 34 | Q_PROPERTY(QQmlListProperty<QSurface3DSeries> seriesList READ seriesList CONSTANT) |
| 35 | Q_PROPERTY(bool flipHorizontalGrid READ flipHorizontalGrid WRITE setFlipHorizontalGrid NOTIFY |
| 36 | flipHorizontalGridChanged) |
| 37 | Q_CLASSINFO("DefaultProperty", "seriesList") |
| 38 | |
| 39 | QML_ADDED_IN_VERSION(6, 10) |
| 40 | QML_NAMED_ELEMENT(Surface3DNode) |
| 41 | |
| 42 | public: |
| 43 | explicit QQuickGraphsSurfaceNode(QQuick3DNode *parent = nullptr); |
| 44 | ~QQuickGraphsSurfaceNode() override; |
| 45 | |
| 46 | QValue3DAxis *axisX() const; |
| 47 | void setAxisX(QValue3DAxis *axis); |
| 48 | |
| 49 | QValue3DAxis *axisY() const; |
| 50 | void setAxisY(QValue3DAxis *axis); |
| 51 | |
| 52 | QValue3DAxis *axisZ() const; |
| 53 | void setAxisZ(QValue3DAxis *axis); |
| 54 | |
| 55 | QSurface3DSeries *selectedSeries() const; |
| 56 | |
| 57 | void setSelectionMode(QtGraphs3D::SelectionFlags mode) override; |
| 58 | |
| 59 | bool flipHorizontalGrid() const; |
| 60 | void setFlipHorizontalGrid(bool flip); |
| 61 | |
| 62 | QList<QSurface3DSeries *> surfaceSeriesList(); |
| 63 | QQmlListProperty<QSurface3DSeries> seriesList(); |
| 64 | static void appendSeriesFunc(QQmlListProperty<QSurface3DSeries> *list, QSurface3DSeries *series); |
| 65 | static qsizetype countSeriesFunc(QQmlListProperty<QSurface3DSeries> *list); |
| 66 | static QSurface3DSeries *atSeriesFunc(QQmlListProperty<QSurface3DSeries> *list, qsizetype index); |
| 67 | static void clearSeriesFunc(QQmlListProperty<QSurface3DSeries> *list); |
| 68 | |
| 69 | Q_INVOKABLE void addSeries(QSurface3DSeries *series); |
| 70 | Q_INVOKABLE void removeSeries(QSurface3DSeries *series); |
| 71 | Q_INVOKABLE void clearSelection() override; |
| 72 | |
| 73 | Q_INVOKABLE bool doPicking(QPointF point) override; |
| 74 | Q_INVOKABLE bool doRayPicking(const QVector3D &origin, const QVector3D &direction) override; |
| 75 | |
| 76 | protected: |
| 77 | void componentComplete() override; |
| 78 | |
| 79 | Q_SIGNALS: |
| 80 | void axisXChanged(QValue3DAxis *axis); |
| 81 | void axisYChanged(QValue3DAxis *axis); |
| 82 | void axisZChanged(QValue3DAxis *axis); |
| 83 | void selectedSeriesChanged(QSurface3DSeries *series); |
| 84 | void flipHorizontalGridChanged(bool flip); |
| 85 | |
| 86 | private: |
| 87 | QQuickGraphsSurface *graphSurface(); |
| 88 | const QQuickGraphsSurface *graphSurface() const; |
| 89 | |
| 90 | bool m_flipHorizontalGrid; |
| 91 | }; |
| 92 | |
| 93 | QT_END_NAMESPACE |
| 94 | |
| 95 | #endif // QQUICKGRAPHSSURFACENODE_P_H |
| 96 |
