Q3DObject Class

Q3DObject 类是三维场景中所有对象的简单基类。更多

头文件: #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
继承于:

Q3DCameraQ3DLight

属性

公共功能

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)

详细说明

包含三维场景中物体的位置信息。该对象被视为坐标空间中的一个点,没有维度。

属性文档

[read-only] parentScene : Q3DScene* const

该属性以只读方式保存父场景的值。

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

访问功能:

Q3DScene *parentScene()

position : QVector3D

此属性保存对象的 3D 位置。

注: 目前设置此属性对Q3DCamera 没有影响,因为位置是在内部处理的。

访问功能:

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

Notifier 信号:

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 3D 对象中的 3D 对象位置复制到此 3D 对象实例中。

[protected] bool Q3DObject::isDirty() const

返回 3D 对象是否已更改。

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

如果 3D 对象自上次更新后发生了更改,则将dirty 设置为true

另请参阅 isDirty().

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