本页内容

Qt3DCore::QGeometry Class

class Qt3DCore::QGeometry

封装几何对象。更多...

头文件: #include <QGeometry>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3DCore)
target_link_libraries(mytarget PRIVATE Qt6::3DCore)
qmake: QT += 3dcore
在 QML 中: Geometry
继承自: Qt3DCore::QNode
被继承类:

Qt3DExtras::QConeGeometry、Qt3DExtras::QCuboidGeometry 、Qt3DExtras::QCylinderGeometry 、Qt3DExtras::QExtrudedTextGeometry 、Qt3DExtras::QPlaneGeometry 、Qt3DExtras::QSphereGeometry 以及Qt3DExtras::QTorusGeometry

状态: 已弃用

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

属性

公共函数

QGeometry(Qt3DCore::QNode *parent = nullptr)
void addAttribute(Qt3DCore::QAttribute *attribute)
QList<Qt3DCore::QAttribute *> attributes() const
Qt3DCore::QAttribute *boundingVolumePositionAttribute() const
QVector3D maxExtent() const
QVector3D minExtent() const
void removeAttribute(Qt3DCore::QAttribute *attribute)

公共槽位

void setBoundingVolumePositionAttribute(Qt3DCore::QAttribute *boundingVolumePositionAttribute)

信号

void boundingVolumePositionAttributeChanged(Qt3DCore::QAttribute *boundingVolumePositionAttribute)
void maxExtentChanged(const QVector3D &maxExtent)
void minExtentChanged(const QVector3D &minExtent)

详细说明

Qt3DCore::QGeometry 类用于将一组Qt3DCore::QAttribute 对象聚合在一起,形成一个几何形状,Qt3D能够使用Qt3DCore::QGeometryRenderer渲染该形状。可以设置特殊属性来计算该形状的包围体积。

属性文档

boundingVolumePositionAttribute : Qt3DCore::QAttribute*

存储用于计算包围体积的属性。包围体积在内部用于拾取操作和视锥体剔除。

如果未指定,系统将使用QAttribute::defaultPositionAttributeName 返回的名称来查找该属性。

访问函数:

Qt3DCore::QAttribute *boundingVolumePositionAttribute() const
void setBoundingVolumePositionAttribute(Qt3DCore::QAttribute *boundingVolumePositionAttribute)

通知信号:

void boundingVolumePositionAttributeChanged(Qt3DCore::QAttribute *boundingVolumePositionAttribute)

另请参阅 Qt3DCore::QAttribute 。

[read-only] maxExtent : QVector3D

包含 x、y、z 坐标值最大的顶点。

访问函数:

QVector3D maxExtent() const

通知信号:

void maxExtentChanged(const QVector3D &maxExtent)

[read-only] minExtent : QVector3D

包含 x、y、z 位置值最小的顶点。

访问函数:

QVector3D minExtent() const

通知信号:

void minExtentChanged(const QVector3D &minExtent)

成员函数文档

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

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

[invokable] void QGeometry::addAttribute(Qt3DCore::QAttribute *attribute)

向该几何体添加一个attribute 。

注意: 可以通过元对象系统和 QML 调用此 函数。参见Q_INVOKABLE 。

QList<Qt3DCore::QAttribute *> QGeometry::attributes() const

返回该几何体中的属性列表。

[invokable] void QGeometry::removeAttribute(Qt3DCore::QAttribute *attribute)

从该几何体中移除指定的attribute 。

注意: 可通过元对象系统或从 QML 中调用此 函数。参见Q_INVOKABLE 。

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