Qt3D Reference Documentation

QGLSceneFormatHandler Class Reference

The QGLSceneFormatHandler class defines the common format I/O interface for loading 3D scene formats. More...

 #include <QGLSceneFormatHandler>

This class was introduced in Qt3D 4.8.

Public Functions

QGLSceneFormatHandler ()
virtual ~QGLSceneFormatHandler ()
virtual void decodeOptions ( const QString & options )
QIODevice * device () const
virtual QGLAbstractScene * download () = 0
void downloadScene ()
void finalize ()
QString format () const
virtual QGLAbstractScene * read () = 0
void setDevice ( QIODevice * device )
void setFormat ( const QString & format )
void setUrl ( const QUrl & url )
QUrl url () const

Public Slots

virtual void downloadComplete ( QByteArray sceneData )

Protected Functions

QGLAbstractScene * getScene () const
void setScene ( QGLAbstractScene * theScene )

Detailed Description

The QGLSceneFormatHandler class defines the common format I/O interface for loading 3D scene formats.

See also QGLSceneFormatPlugin.

Member Function Documentation

QGLSceneFormatHandler::QGLSceneFormatHandler ()

Constructs a 3D scene format handler.

QGLSceneFormatHandler::~QGLSceneFormatHandler () [virtual]

Destroys this 3D scene format handler.

void QGLSceneFormatHandler::decodeOptions ( const QString & options ) [virtual]

Decodes and applies options to this handler. Generally this will be called by the QGLAbstractScene::loadScene() method prior to reading the model data with read() or download(). Exactly what the string value may contain and the meaning of the encoded options depends on each individual plugin.

This default implementation simply does nothing.

QIODevice * QGLSceneFormatHandler::device () const

Returns the device currently assigned to the 3D scene format handler. Returns null if no device has been assigned.

See also setDevice().

QGLAbstractScene * QGLSceneFormatHandler::download () [pure virtual]

Reads a 3D scene from a url and returns a stub to it which can be used the application, and will be updated with the full scene later.

Returns NULL if the scene could not be created.

void QGLSceneFormatHandler::downloadComplete ( QByteArray sceneData ) [virtual slot]

This function should be called when the download of a remotely hosted scene is complete. The sceneData will contain the relevant data for the scene.

The user is required to reimplement this if they intend to support network loading of scenes in their plugin.

void QGLSceneFormatHandler::downloadScene ()

Initiates download of the specified scene. The scene must have been previously specified with URL, options, format, and so on. This function will then create a QGLAbstractDownloadManager instance and submit the network request for the scene.

The resultant data will be handled by the downloadComplete() slot.

void QGLSceneFormatHandler::finalize ()

Called at the end of the read() and download() functions, this function completes any extra cleanup required, and sets the QGLSceneFormatHandler it belongs to as being ready for deletion when the main event loop is next processed.

QString QGLSceneFormatHandler::format () const

Returns the format that is currently assigned to this 3D scene format handler. Returns an empty string if no format has been assigned.

See also setFormat().

QGLAbstractScene * QGLSceneFormatHandler::getScene () const [protected]

Get the pointer for the scene currently being processed. This is specifically used during network loading.

QGLAbstractScene * QGLSceneFormatHandler::read () [pure virtual]

Reads a 3D scene from device() and returns it. Returns null if the format of device() is invalid and a scene could not be read.

void QGLSceneFormatHandler::setDevice ( QIODevice * device )

Sets the device for this 3D scene format handler to device. The handler will use this device when reading 3D scenes.

The device can only be set once and must be set before calling read(). If you need to read multiple files, construct multiple instances of the appropriate QGLSceneFormatHandler subclass.

See also device().

void QGLSceneFormatHandler::setFormat ( const QString & format )

Sets the format of this 3D scene format handler to format.

See also format().

void QGLSceneFormatHandler::setScene ( QGLAbstractScene * theScene ) [protected]

Set the pointer for the scene theScene currently being processed. This is specifically used during network loading.

void QGLSceneFormatHandler::setUrl ( const QUrl & url )

Sets the url of the data provided by device().

See also url().

QUrl QGLSceneFormatHandler::url () const

Returns the url of the data provided by device(). This is typically used when the data in device() refers to additional files that need to be located relative to the original directory.

See also setUrl().