QQuick3DObject Class

所有 3D 节点和资源的基类。更多

Header: #include <QQuick3DObject>
In QML: Object3D
Inherits: QObject and QQmlParserStatus
Inherited By:

QQuick3DGeometry, QQuick3DInstancing, QQuick3DRenderExtension, and QQuick3DTextureData

属性

公共功能

QQuick3DObject *parentItem() const
void setState(const QString &state)
QString state() const

公共插槽

void setParentItem(QQuick3DObject *parentItem)

信号

void parentChanged()
void stateChanged()

详细说明

Object3D 是所有 3D 场景对象的基类。目前,在 C++ 中可用的类型有: QQuick3DObject 和 QQuick3DObject:Qt Quick

这两种类型都是直接继承了 QQuick3DObject 的资源对象。

目前没有必要在任何地方直接使用 QQuick3DObject,因为它只是一个接口,用于支持三维场景中的空间项目和资源,以及为三维场景内容提供类似于QQuickItem 的功能。

属性文档

parent : QQuick3DObject*

此属性表示Object3D 在 3D 场景中的父对象。

注: Object3D 的父对象不一定与其对象父对象相同。这是必要的,因为对象父对象可能不是Object3D 类型的项目,例如场景中的根对象。

注: 目前,当从 C++ 生成三维对象的父对象时,场景管理器必须在QObject::setParent 之前调用 QQuick3DObject::setParentItem 才能正确处理三维项目。不过,这一要求可能会在未来的版本中改变。

QQuick3DObject *newItem = new QQuick3DObject();
newItem->setParentItem(parentItem);
newItem->setParent(parentItem);

访问函数:

QQuick3DObject *parentItem() const
void setParentItem(QQuick3DObject *parentItem)

通知信号:

void parentChanged()

state : QString

该属性包含对象当前状态的名称。

如果项目处于默认状态,即未设置显式状态,则此属性为空字符串。同样,通过将此属性设置为空字符串,也可以将项目返回到默认状态。

访问函数:

QString state() const
void setState(const QString &state)

Notifier 信号:

void stateChanged()

另请参阅 Qt Quick 状态

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