Qt3DExtras::QText2DEntity Class
class Qt3DExtras::QText2DEntityQText2DEntity 允许在三维空间中创建二维文本。更多
头文件: | #include <Qt3DExtras/QText2DEntity> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3dextras) target_link_libraries(mytarget PRIVATE Qt6::3dextras) |
qmake: | QT += 3dextras |
在 QML 中: | Text2DEntity |
继承: | Qt3DCore::QEntity |
状态: | 已废弃 |
属性
公共功能
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 |
信号
void | colorChanged(const QColor &color) |
void | fontChanged(const QFont &font) |
void | heightChanged(float height) |
void | textChanged(const QString &text) |
void | widthChanged(float width) |
详细说明
QText2DEntity 在 XY 平面上将文本渲染为三角形。几何图形将适合指定宽度和高度的矩形。如果生成的几何体宽度大于指定宽度,剩余部分将渲染到新线上。
实体可通过添加变换组件在场景中定位。
QText2DEntity 将根据字形的形状创建几何体,并使用指定的颜色创建实体材质。
属性文档
alignment : Qt::Alignment
返回Qt Quick 场景中显示的文本项目的对齐方式。
默认对齐方式为左上对齐。
访问功能:
Qt::Alignment | alignment() const |
void | setAlignment(Qt::Alignment alignment) |
color : QColor
保存Qt Quick 场景中显示的文本项目的颜色。
访问功能:
QColor | color() const |
void | setColor(const QColor &color) |
通知信号:
void | colorChanged(const QColor &color) |
font : QFont
保存Qt Quick 场景中显示的文本项目的字体。
访问功能:
QFont | font() const |
void | setFont(const QFont &font) |
通知信号:
void | fontChanged(const QFont &font) |
height : float
返回Qt Quick 场景中显示的文本项的高度。
访问功能:
float | height() const |
void | setHeight(float height) |
通知信号:
void | heightChanged(float height) |
text : QString
保存在Qt Quick 场景中显示的文本。
访问功能:
QString | text() const |
void | setText(const QString &text) |
通知信号:
void | textChanged(const QString &text) |
width : float
返回Qt Quick 场景中显示的文本项的宽度。
访问功能:
float | width() const |
void | setWidth(float width) |
通知信号:
void | widthChanged(float width) |
© 2025 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.