QBuffer Class


Provides a data store for raw data to later be used as vertices or uniforms. More...

Header: #include <Qt3DRender/QBuffer>
qmake: QT += 3drender
Instantiated By: Buffer
Inherits: Qt3DCore::QNode

Public Types

enum AccessType { Write, Read, ReadWrite }
enum UsageType { StreamDraw, StreamRead, StreamCopy, StaticDraw, ..., DynamicCopy }


Public Functions

QBuffer(Qt3DCore::QNode *parent = nullptr)
Qt3DRender::QBuffer::AccessType accessType() const
QByteArray data() const
Qt3DRender::QBufferDataGeneratorPtr dataGenerator() const
bool isSyncData() const
void setData(const QByteArray &bytes)
void setDataGenerator(const Qt3DRender::QBufferDataGeneratorPtr &functor)
void updateData(int offset, const QByteArray &bytes)
Qt3DRender::QBuffer::UsageType usage() const

Public Slots

void setAccessType(Qt3DRender::QBuffer::AccessType access)
void setSyncData(bool syncData)
void setUsage(Qt3DRender::QBuffer::UsageType usage)


void accessTypeChanged(Qt3DRender::QBuffer::AccessType access)
void dataAvailable()
void dataChanged(const QByteArray &bytes)
void syncDataChanged(bool syncData)
void usageChanged(Qt3DRender::QBuffer::UsageType usage)

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 2 protected functions inherited from Qt3DCore::QNode
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

Provides a data store for raw data to later be used as vertices or uniforms.

Data can either be provided directly using QBuffer::setData() or by specifying a generator with QBuffer::setDataGenerator() and providing a Qt3DRender::QBufferDataGeneratorPtr.

When using a generator the data will be loaded asynchronously in a job. The loaded data can be read back if the QBuffer::syncData flag is set to true.

Member Type Documentation

enum QBuffer::AccessType

enum QBuffer::UsageType

The type of the usage.


Property Documentation

accessType : AccessType

Access functions:

Qt3DRender::QBuffer::AccessType accessType() const
void setAccessType(Qt3DRender::QBuffer::AccessType access)

Notifier signal:

void accessTypeChanged(Qt3DRender::QBuffer::AccessType access)

syncData : bool

Holds the syncData flag. When syncData is true, this will force data created by a Qt3DRender::QBufferDataGenerator to also be updated on the frontend Qt3DRender::QBuffer node. By default syncData is false.

Note: : This has no effect if the buffer's data was set directly using the data property.

Access functions:

bool isSyncData() const
void setSyncData(bool syncData)

Notifier signal:

void syncDataChanged(bool syncData)

usage : UsageType

Holds the buffer usage.

Access functions:

Qt3DRender::QBuffer::UsageType usage() const
void setUsage(Qt3DRender::QBuffer::UsageType usage)

Notifier signal:

void usageChanged(Qt3DRender::QBuffer::UsageType usage)

Member Function Documentation

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

Constructs a new QBuffer with parent.

QByteArray QBuffer::data() const

Returns the data.

See also setData().

[signal] void QBuffer::dataAvailable()

[signal] void QBuffer::dataChanged(const QByteArray &bytes)

This signal is emitted with bytes when data changes.

Qt3DRender::QBufferDataGeneratorPtr QBuffer::dataGenerator() const

Returns the buffer functor.

See also setDataGenerator().

void QBuffer::setData(const QByteArray &bytes)

Sets bytes as data.

See also data().

void QBuffer::setDataGenerator(const Qt3DRender::QBufferDataGeneratorPtr &functor)

Sets the buffer functor.

See also dataGenerator().

void QBuffer::updateData(int offset, const QByteArray &bytes)

Updates the data by replacing it with bytes at offset.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

Related Non-Members

typedef Qt3DRender::QBufferDataGeneratorPtr

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