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 : const QVector3D

保存 x、y、z 位置值最大的顶点。

访问功能:

QVector3D maxExtent() const

通知信号:

void maxExtentChanged(const QVector3D &maxExtent)

[read-only] minExtent : const QVector3D

保存 x、y、z 位置值最小的顶点。

访问功能:

QVector3D minExtent() const

通知信号:

void minExtentChanged(const QVector3D &minExtent)

成员函数 文档

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

构造一个新的 QGeometry,parent

[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

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