本页内容

Qt3DExtras::QExtrudedTextGeometry Class

class Qt3DExtras::QExtrudedTextGeometry

QExtrudedTextGeometry 类可用于在三维空间中创建三维挤出文本。更多内容...

标题: #include <Qt3DExtras/QExtrudedTextGeometry>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dextras)
target_link_libraries(mytarget PRIVATE Qt6::3dextras)
qmake: QT += 3dextras
在 QML 中: ExtrudedTextGeometry
继承自: Qt3DCore::QGeometry
状态: 已弃用

该类已弃用。我们强烈建议在新代码中不要使用它。

属性

公共函数

QExtrudedTextGeometry(Qt3DCore::QNode *parent = nullptr)
float extrusionLength() const
QFont font() const
Qt3DCore::QAttribute *indexAttribute() const
Qt3DCore::QAttribute *normalAttribute() const
Qt3DCore::QAttribute *positionAttribute() const
QString text() const

公共槽位

void setDepth(float extrusionLength)
void setFont(const QFont &font)
void setText(const QString &text)

信号

void depthChanged(float extrusionLength)
void fontChanged(const QFont &font)
void textChanged(const QString &text)

详细说明

QExtrudedTextGeometry 类最常被 QText3DMesh 在内部使用,但也可用于自定义的Qt3DRender::QGeometryRenderer 子类中。

几何体的原点是文本基线的左后端。

属性文档

extrusionLength : float

存储文本的挤出长度。

访问函数:

float extrusionLength() const
void setDepth(float extrusionLength)

通知信号:

void depthChanged(float extrusionLength)

font : QFont

存储文本的字体。

几何形状会根据字体的 pointSize 进行归一化处理,因此 pointSize 越大,生成的文本会越平滑,而非字号越大。不应使用 pixelSize。

访问函数:

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

通知器信号:

void fontChanged(const QFont &font)

[read-only] indexAttribute : Qt3DCore::QAttribute* const

存储几何索引属性。

访问函数:

Qt3DCore::QAttribute *indexAttribute() const

[read-only] normalAttribute : Qt3DCore::QAttribute* const

存储几何体法线属性。

访问函数:

Qt3DCore::QAttribute *normalAttribute() const

[read-only] positionAttribute : Qt3DCore::QAttribute* const

存储几何位置属性。

访问函数:

Qt3DCore::QAttribute *positionAttribute() const

text : QString

存储用于网格的文本。

访问函数:

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

通知信号:

void textChanged(const QString &text)

成员函数文档

[explicit] QExtrudedTextGeometry::QExtrudedTextGeometry(Qt3DCore::QNode *parent = nullptr)

使用parent 创建一个新的 QExtrudedTextGeometry 对象。

© 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.