本页内容

Q3DObject Class

Q3DObject 类是 3D 场景中所有对象的一个简单基类。更多内容...

头文件: #include <Q3DObject>
CMake: find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
qmake: QT += datavisualization
自: QtDataVisualization 1.0
在 QML 中: Object3D
继承自: QObject
被继承者:

Q3DCamera 以及Q3DLight

状态: 已弃用

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

属性

公共函数

Q3DObject(QObject *parent = nullptr)
virtual ~Q3DObject()
virtual void copyValuesFrom(const Q3DObject &source)
Q3DScene *parentScene()
QVector3D position() const
void setPosition(const QVector3D &position)

信号

void positionChanged(const QVector3D &position)

受保护函数

bool isDirty() const
void setDirty(bool dirty)

详细说明

包含 3D 场景中某个对象的位置信息。该对象被视为坐标空间中一个无尺寸的单点。

属性文档

[read-only] parentScene : Q3DScene*

该属性将父场景作为只读值存储。

如果对象没有父场景,则该值为 0。

访问函数:

Q3DScene *parentScene()

position : QVector3D

该属性存储了对象的 3D 位置。

注意:目前, 对 Q3DCamera 设置此属性不会产生任何效果,因为其位置由内部处理。

访问函数:

QVector3D position() const
void setPosition(const QVector3D &position)

通知信号:

void positionChanged(const QVector3D &position)

成员函数文档

[explicit] Q3DObject::Q3DObject(QObject *parent = nullptr)

创建一个新的 3D 对象,其位置默认设置为原点。可以提供一个可选的 `parent ` 参数,该参数将传递给 `QObject ` 构造函数。

[virtual noexcept] Q3DObject::~Q3DObject()

删除该3D对象。

[virtual] void Q3DObject::copyValuesFrom(const Q3DObject &source)

将给定的source 三维对象的位置复制到此三维对象实例中。

[protected] bool Q3DObject::isDirty() const

返回该3D对象是否已发生变化。

[protected] void Q3DObject::setDirty(bool dirty)

如果自上次更新以来 3D 对象发生了变化,则将 `dirty ` 设置为 `true `。

另请参阅 isDirty()。

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