Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
gridgeometry_p.h
Go to the documentation of this file.
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 <QtQuick3DHelpers/qtquick3dhelpersexports.h>
19#include <QtQuick3D/private/qquick3dgeometry_p.h>
20
22
23class Q_QUICK3DHELPERS_EXPORT GridGeometry : public QQuick3DGeometry
24{
25 Q_OBJECT
26 Q_PROPERTY(int horizontalLines READ horizontalLines WRITE setHorizontalLines NOTIFY horizontalLinesChanged)
27 Q_PROPERTY(int verticalLines READ verticalLines WRITE setVerticalLines NOTIFY verticalLinesChanged)
28 Q_PROPERTY(float horizontalStep READ horizontalStep WRITE setHorizontalStep NOTIFY horizontalStepChanged)
29 Q_PROPERTY(float verticalStep READ verticalStep WRITE setVerticalStep NOTIFY verticalStepChanged)
30 QML_NAMED_ELEMENT(GridGeometry)
31
32public:
33 GridGeometry();
34 ~GridGeometry() override;
35
36 int horizontalLines() const;
37 int verticalLines() const;
38 float horizontalStep() const;
39 float verticalStep() const;
40
41public Q_SLOTS:
42 void setHorizontalLines(int count);
43 void setVerticalLines(int count);
44 void setHorizontalStep(float step);
45 void setVerticalStep(float step);
46
47Q_SIGNALS:
48 void horizontalLinesChanged();
49 void verticalLinesChanged();
50 void horizontalStepChanged();
51 void verticalStepChanged();
52
53private:
54 void updateData();
55
56 int m_horLines = 1000;
57 int m_vertLines = 1000;
58 float m_horStep = .1f;
59 float m_vertStep = .1f;
60};
61
62QT_END_NAMESPACE
63
64#endif
static void fillVertexData(QByteArray &vertexData, int horLines, float horStep, int vertLines, float vertStep)