QSceneLoader Class


Provides the facility to load an existing Scene More...

Header: #include <QSceneLoader>
qmake: QT += 3drender
Since: Qt 5.7
Instantiated By: SceneLoader
Inherits: Qt3DCore::QComponent

Public Types

enum Status { None, Loading, Ready, Error }


Public Functions

QSceneLoader(Qt3DCore::QNode *parent = nullptr)
QUrl source() const
Status status() const

Public Slots

void setSource(const QUrl &arg)


void sourceChanged(const QUrl &source)
void statusChanged(Status status)

Protected Functions

QSceneLoader(QSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr)

Additional Inherited Members

  • 11 static public members inherited from QObject

Detailed Description

Provides the facility to load an existing Scene

Given a 3D source file, the Qt3DRender::QSceneLoader will try to parse it and build a tree of Qt3DCore::QEntity objects with proper Qt3DRender::QGeometryRenderer, Qt3DCore::QTransform and Qt3DRender::QMaterial components.

The loader will try to determine the best material to be used based on the properties of the model file. If you wish to use a custom material, you will have to traverse the tree and replace the default associated materials with yours.

As the name implies, Qt3DRender::QSceneLoader loads a complete scene subtree. If you wish to load a single piece of geometry, you should rather use the Qt3DRender::QMesh instead.

Qt3DRender::QSceneLoader internally relies on the use of plugins to support a wide variety of 3D file formats. Here is a list of formats that are supported by Qt3D.

Note: this component shouldn't be shared among several Qt3DCore::QEntity instances. Undefined behavior will result.

See also Qt3DRender::QMesh and Qt3DRender::QGeometryRenderer.

Member Type Documentation

enum QSceneLoader::Status

This enum identifies the state of loading

Qt3DRender::QSceneLoader::None0The Qt3DRender::QSceneLoader hasn't been used yet.
Qt3DRender::QSceneLoader::Loading1The Qt3DRender::QSceneLoader is currently loading the scene file.
Qt3DRender::QSceneLoader::Ready2The Qt3DRender::QSceneLoader successfully loaded the scene file.
Qt3DRender::QSceneLoader::Error3The Qt3DRender::QSceneLoader encountered an error while loading the scene file.

Property Documentation

source : QUrl

Holds the url to the source to be loaded.

Access functions:

QUrl source() const
void setSource(const QUrl &arg)

Notifier signal:

void sourceChanged(const QUrl &source)

status : const Status

Holds the status of scene loading.

Access functions:

Status status() const

Notifier signal:

void statusChanged(Status status)

See also Qt3DRender::QSceneLoader::Status.

Member Function Documentation

QSceneLoader::QSceneLoader(Qt3DCore::QNode *parent = nullptr)

Default constructs an instance of QSceneLoader.

[protected] QSceneLoader::QSceneLoader(QSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr)

Copy constructor.

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