| 1 | // Copyright (C) 2019 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 Qt 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 | |
| 15 | #ifndef GRID_GEOMETRY_H |
| 16 | #define GRID_GEOMETRY_H |
| 17 | |
| 18 | #include <QtQuick3D/private/qquick3dgeometry_p.h> |
| 19 | |
| 20 | // Workaround for QTBUG-94099, ensures qml_register_types...() is exported |
| 21 | #include "qtquick3dhelpersglobal_p.h" |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class GridGeometry : public QQuick3DGeometry |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | Q_PROPERTY(int horizontalLines READ horizontalLines WRITE setHorizontalLines NOTIFY horizontalLinesChanged) |
| 29 | Q_PROPERTY(int verticalLines READ verticalLines WRITE setVerticalLines NOTIFY verticalLinesChanged) |
| 30 | Q_PROPERTY(float horizontalStep READ horizontalStep WRITE setHorizontalStep NOTIFY horizontalStepChanged) |
| 31 | Q_PROPERTY(float verticalStep READ verticalStep WRITE setVerticalStep NOTIFY verticalStepChanged) |
| 32 | QML_NAMED_ELEMENT(GridGeometry) |
| 33 | |
| 34 | public: |
| 35 | GridGeometry(); |
| 36 | ~GridGeometry() override; |
| 37 | |
| 38 | int horizontalLines() const; |
| 39 | int verticalLines() const; |
| 40 | float horizontalStep() const; |
| 41 | float verticalStep() const; |
| 42 | |
| 43 | public Q_SLOTS: |
| 44 | void setHorizontalLines(int count); |
| 45 | void setVerticalLines(int count); |
| 46 | void setHorizontalStep(float step); |
| 47 | void setVerticalStep(float step); |
| 48 | |
| 49 | Q_SIGNALS: |
| 50 | void horizontalLinesChanged(); |
| 51 | void verticalLinesChanged(); |
| 52 | void horizontalStepChanged(); |
| 53 | void verticalStepChanged(); |
| 54 | |
| 55 | private: |
| 56 | void updateData(); |
| 57 | |
| 58 | int m_horLines = 1000; |
| 59 | int m_vertLines = 1000; |
| 60 | float m_horStep = .1f; |
| 61 | float m_vertStep = .1f; |
| 62 | }; |
| 63 | |
| 64 | QT_END_NAMESPACE |
| 65 | |
| 66 | #endif |
| 67 | |