1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qextrudedtextmesh.h"
#include "qextrudedtextgeometry.h"
QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
/*!
* \qmltype ExtrudedTextMesh
* \nativetype Qt3DExtras::QExtrudedTextMesh
* \inqmlmodule Qt3D.Extras
* \brief A 3D extruded Text mesh.
*
* The origin of the mesh is the rear left end of the text's baseline.
*/
/*!
* \qmlproperty string Qt3D.Extras::ExtrudedTextMesh::text
*
* Holds the text used for the mesh.
*/
/*!
* \qmlproperty font Qt3D.Extras::ExtrudedTextMesh::font
*
* Holds the font of the text.
* The mesh geometry is normalized by the font's pointSize, so a larger pointSize
* will result in smoother, rather than larger, text. pixelSize should not
* be used.
*/
/*!
* \qmlproperty real Qt3D.Extras::ExtrudedTextMesh::depth
*
* Holds the extrusion depth of the text.
*/
/*!
* \class Qt3DExtras::QExtrudedTextMesh
* \inheaderfile Qt3DExtras/QExtrudedTextMesh
* \inmodule Qt3DExtras
*
* \inherits Qt3DRender::QGeometryRenderer
*
* \brief A 3D extruded Text mesh.
*
* The origin of the mesh is the rear left end of the text's baseline.
*/
/*!
* Constructs a new QText3DMesh with \a parent.
*/
QExtrudedTextMesh::QExtrudedTextMesh(Qt3DCore::QNode *parent)
: QGeometryRenderer(parent)
{
QExtrudedTextGeometry *geometry = new QExtrudedTextGeometry();
QObject::connect(geometry, &QExtrudedTextGeometry::depthChanged, this, &QExtrudedTextMesh::depthChanged);
QObject::connect(geometry, &QExtrudedTextGeometry::textChanged, this, &QExtrudedTextMesh::textChanged);
QObject::connect(geometry, &QExtrudedTextGeometry::fontChanged, this, &QExtrudedTextMesh::fontChanged);
QGeometryRenderer::setGeometry(geometry);
}
/*! \internal */
QExtrudedTextMesh::~QExtrudedTextMesh()
{}
void QExtrudedTextMesh::setText(const QString &text)
{
static_cast<QExtrudedTextGeometry*>(geometry())->setText(text);
}
void QExtrudedTextMesh::setFont(const QFont &font)
{
static_cast<QExtrudedTextGeometry*>(geometry())->setFont(font);
}
void QExtrudedTextMesh::setDepth(float depth)
{
static_cast<QExtrudedTextGeometry*>(geometry())->setDepth(depth);
}
/*!
* \property Qt3DExtras::QExtrudedTextMesh::text
*
* Holds the text used for the mesh.
*/
QString QExtrudedTextMesh::text() const
{
return static_cast<QExtrudedTextGeometry*>(geometry())->text();
}
/*!
* \property Qt3DExtras::QExtrudedTextMesh::font
*
* Holds the font of the text.
*
* The mesh geometry is normalized by the font's pointSize, so a larger pointSize
* will result in smoother, rather than larger, text. pixelSize should not
* be used.
*/
QFont QExtrudedTextMesh::font() const
{
return static_cast<QExtrudedTextGeometry*>(geometry())->font();
}
/*!
* \property Qt3DExtras::QExtrudedTextMesh::depth
*
* Holds the extrusion depth of the text.
*/
float QExtrudedTextMesh::depth() const
{
return static_cast<QExtrudedTextGeometry*>(geometry())->extrusionLength();
}
} // namespace Qt3DExtras
QT_END_NAMESPACE
#include "moc_qextrudedtextmesh.cpp"
|