Sur cette page

Qt3DExtras::QText2DEntity Class

class Qt3DExtras::QText2DEntity

QText2DEntity permet de créer un texte 2D dans un espace 3D. Plus d'informations...

En-tête : #include <Qt3DExtras/QText2DEntity>
CMake : find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake : QT += 3dextras
En QML : Text2DEntity
Hérite : Qt3DCore::QEntity
Statut : Déclassé

Propriétés

Fonctions publiques

Qt::Alignment alignment() const
QColor color() const
QFont font() const
float height() const
void setAlignment(Qt::Alignment alignment)
void setColor(const QColor &color)
void setFont(const QFont &font)
void setHeight(float height)
void setText(const QString &text)
void setWidth(float width)
QString text() const
float width() const

Signaux

void colorChanged(const QColor &color)
void fontChanged(const QFont &font)
void heightChanged(float height)
void textChanged(const QString &text)
void widthChanged(float width)

Description détaillée

L'entité QText2DE rend le texte sous forme de triangles dans le plan XY. La géométrie sera ajustée dans le rectangle de la largeur et de la hauteur spécifiées. Si la géométrie résultante est plus large que la largeur spécifiée, le reste sera rendu sur la nouvelle ligne.

L'entité peut être positionnée dans la scène en ajoutant un composant de transformation.

QText2DEntity créera une géométrie basée sur la forme des glyphes et un matériau solide utilisant la couleur spécifiée.

Documentation sur les propriétés

alignment : Qt::Alignment

Renvoie l'alignement de l'élément de texte affiché dans la scène Qt Quick.

L'alignement par défaut est en haut à gauche.

Fonctions d'accès :

Qt::Alignment alignment() const
void setAlignment(Qt::Alignment alignment)

color : QColor

Définit la couleur de l'élément de texte affiché dans la scène Qt Quick.

Fonctions d'accès :

QColor color() const
void setColor(const QColor &color)

Signal de notification :

void colorChanged(const QColor &color)

font : QFont

Définit la police de l'élément de texte affiché dans la scène Qt Quick.

Fonctions d'accès :

QFont font() const
void setFont(const QFont &font)

Signal de notification :

void fontChanged(const QFont &font)

height : float

Renvoie la hauteur de l'élément de texte affiché dans la scène Qt Quick.

Fonctions d'accès :

float height() const
void setHeight(float height)

Signal de notification :

void heightChanged(float height)

text : QString

Contient le texte qui s'affiche dans la scène Qt Quick.

Fonctions d'accès :

QString text() const
void setText(const QString &text)

Signal de notification :

void textChanged(const QString &text)

width : float

Renvoie la largeur de l'élément de texte affiché dans la scène Qt Quick.

Fonctions d'accès :

float width() const
void setWidth(float width)

Signal de notification :

void widthChanged(float width)

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.