summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2018-11-07 15:46:31 +0000
committerMike Krus <mike.krus@kdab.com>2018-11-08 06:56:54 +0000
commit7dbb81e94a9966fa4c0d16814bf9406dd6a1f398 (patch)
treef2d8e4742d0388d28bd58fce3d8bfe34ac071de8
parent0d9aee0c22fb6bc4ff57c03f54b67d2817e1e886 (diff)
Add documentation for QText2DEntity
Also fix the shaders to work on macOS Change-Id: If1fb183741c21b284474c9d747c8dd4c70b9d779 Reviewed-by: Wieland Hagen <wieland.hagen@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/extras/shaders/gl3/distancefieldtext.frag2
-rw-r--r--src/extras/shaders/gl3/distancefieldtext.vert2
-rw-r--r--src/extras/text/qtext2dentity.cpp95
3 files changed, 88 insertions, 11 deletions
diff --git a/src/extras/shaders/gl3/distancefieldtext.frag b/src/extras/shaders/gl3/distancefieldtext.frag
index c53f3df55..23dff8e0f 100644
--- a/src/extras/shaders/gl3/distancefieldtext.frag
+++ b/src/extras/shaders/gl3/distancefieldtext.frag
@@ -1,4 +1,4 @@
-#version 130
+#version 150 core
uniform sampler2D distanceFieldTexture;
uniform float minAlpha;
diff --git a/src/extras/shaders/gl3/distancefieldtext.vert b/src/extras/shaders/gl3/distancefieldtext.vert
index 74a48f426..f6743001c 100644
--- a/src/extras/shaders/gl3/distancefieldtext.vert
+++ b/src/extras/shaders/gl3/distancefieldtext.vert
@@ -1,4 +1,4 @@
-#version 130
+#version 150 core
in vec3 vertexPosition;
in vec2 vertexTexCoord;
diff --git a/src/extras/text/qtext2dentity.cpp b/src/extras/text/qtext2dentity.cpp
index ae25e8ecc..aa4785fe7 100644
--- a/src/extras/text/qtext2dentity.cpp
+++ b/src/extras/text/qtext2dentity.cpp
@@ -69,6 +69,72 @@ inline Q_DECL_CONSTEXPR QRectF scaleRectF(const QRectF &rect, float scale)
namespace Qt3DExtras {
+/*!
+ * \qmltype Text2DEntity
+ * \instantiates Qt3DExtras::QText2DEntity
+ * \inqmlmodule Qt3D.Extras
+ * \brief Text2DEntity allows creation of a 2D text in 3D space.
+ *
+ * The Text2DEntity renders text as triangles in the XY plane. The geometry will be fitted
+ * in the rectangle of specified width and height. If the resulting geometry is wider than
+ * the specified width, the remainder will be rendered on the new line.
+ *
+ * The entity can be positionned in the scene by adding a transform component.
+ *
+ * Text2DEntity will create geometry based on the shape of the glyphs and a solid
+ * material using the specified color.
+ *
+ */
+
+/*!
+ * \qmlproperty QString Text2DEntity::text
+ *
+ * Holds the text used for the mesh.
+ */
+
+/*!
+ * \qmlproperty QFont Text2DEntity::font
+ *
+ * Holds the font of the text.
+ */
+
+/*!
+ * \qmlproperty QColor Text2DEntity::color
+ *
+ * Holds the color of the text.
+ */
+
+/*!
+ * \qmlproperty float Text2DEntity::width
+ *
+ * Holds the width of the text's bounding rectangle.
+ */
+
+/*!
+ * \qmlproperty float Text2DEntity::height
+ *
+ * Holds the height of the text's bounding rectangle.
+ */
+
+
+/*!
+ * \class Qt3DExtras::QText2DEntity
+ * \inheaderfile Qt3DExtras/QText2DEntity
+ * \inmodule Qt3DExtras
+ *
+ * \brief QText2DEntity allows creation of a 2D text in 3D space.
+ *
+ * The QText2DEntity renders text as triangles in the XY plane. The geometry will be fitted
+ * in the rectangle of specified width and height. If the resulting geometry is wider than
+ * the specified width, the remainder will be rendered on the new line.
+ *
+ * The entity can be positionned in the scene by adding a transform component.
+ *
+ * QText2DEntity will create geometry based on the shape of the glyphs and a solid
+ * material using the specified color.
+ *
+ */
+
QHash<Qt3DCore::QScene *, QText2DEntityPrivate::CacheEntry> QText2DEntityPrivate::m_glyphCacheInstances;
QText2DEntityPrivate::QText2DEntityPrivate()
@@ -129,6 +195,7 @@ QText2DEntity::QText2DEntity(QNode *parent)
{
}
+/*! \internal */
QText2DEntity::~QText2DEntity()
{
}
@@ -298,8 +365,10 @@ void QText2DEntityPrivate::update()
}
/*!
- Returns the font for the text item that is displayed
- in the Qt Quick scene.
+ \property QText2DEntity::font
+
+ Holds the font for the text item that is displayed
+ in the Qt Quick scene.
*/
QFont QText2DEntity::font() const
{
@@ -326,8 +395,10 @@ void QText2DEntity::setFont(const QFont &font)
}
/*!
- Returns the color for the text item that is displayed in the Qt
- Quick scene.
+ \property QText2DEntity::color
+
+ Holds the color for the text item that is displayed in the Qt
+ Quick scene.
*/
QColor QText2DEntity::color() const
{
@@ -349,7 +420,9 @@ void QText2DEntity::setColor(const QColor &color)
}
/*!
- Returns the text that is displayed in the Qt Quick scene.
+ \property QText2DEntity::text
+
+ Holds the text that is displayed in the Qt Quick scene.
*/
QString QText2DEntity::text() const
{
@@ -369,8 +442,10 @@ void QText2DEntity::setText(const QString &text)
}
/*!
- Returns the width of the text item that is displayed in the
- Qt Quick scene.
+ \property QText2DEntity::width
+
+ Returns the width of the text item that is displayed in the
+ Qt Quick scene.
*/
float QText2DEntity::width() const
{
@@ -379,8 +454,10 @@ float QText2DEntity::width() const
}
/*!
- Returns the width of the text item that is displayed in the
- Qt Quick scene.
+ \property QText2DEntity::height
+
+ Returns the height of the text item that is displayed in the
+ Qt Quick scene.
*/
float QText2DEntity::height() const
{