Q3DSWidget Class

Displays a Qt 3D Studio presentation on a widget. More...

Header: #include <q3dswidget.h>
Inherits: QOpenGLWidget


  • 59 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

Q3DSWidget(QWidget *parent = nullptr)
virtual ~Q3DSWidget()
bool initialize()
bool isRunning() const
Q3DSPresentation *presentation() const
Q3DSViewerSettings *settings() const
int updateInterval() const

Public Slots

void reset()
void setUpdateInterval(int interval)
void shutdown()
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject


void runningChanged(bool initialized)
void updateIntervalChanged(bool autoUpdate)

Reimplemented Protected Functions

virtual void initializeGL() override
virtual void keyPressEvent(QKeyEvent *event) override
virtual void keyReleaseEvent(QKeyEvent *event) override
virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
virtual void mouseReleaseEvent(QMouseEvent *event) override
virtual void paintGL() override
virtual void resizeGL(int w, int h) override
virtual void wheelEvent(QWheelEvent *event) override

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 5 static public members inherited from QWidget
  • 10 static public members inherited from QObject
  • 5 protected functions inherited from QOpenGLWidget
  • 35 protected functions inherited from QWidget
  • 9 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice
  • 1 protected slot inherited from QWidget
  • 2 protected variables inherited from QObject
  • 1 protected type inherited from QPaintDevice

Detailed Description

Displays a Qt 3D Studio presentation on a widget.

Q3DSWidget is used to specify a render widget for Qt 3D Studio presentation.

Example Usage

Q3DSWidget viewer;

// Register a scene element object for slide management (optional)
Q3DSSceneElement scene(viewer.presentation(), QStringLiteral("Scene"));

// Register an element object for attribute setting (optional)
Q3DSElement element(viewer.presentation(), QStringLiteral("Scene.Layer.myLabel"));


See also Q3DSSurfaceViewer.

Property Documentation

running : const bool

The value of this property is true when the viewer has been initialized and the presentation is running.

This property is read-only.

Access functions:

bool isRunning() const

Notifier signal:

void runningChanged(bool initialized)

updateInterval : int

Holds the viewer update interval in milliseconds. If the value is negative, the viewer doesn't update the presentation automatically.

The default value is -1.

Access functions:

int updateInterval() const
void setUpdateInterval(int interval)

Notifier signal:

void updateIntervalChanged(bool autoUpdate)

See also QWidget::update().

Member Function Documentation

Q3DSWidget::Q3DSWidget(QWidget *parent = nullptr)

Default constructs an instance of Q3DSWidget.

[virtual] Q3DSWidget::~Q3DSWidget()

Destroys the instance of Q3DSWidget. The destructor is virtual.

bool Q3DSWidget::initialize()

Initializes Q3DSWidget to render the presentation.

The source property of the attached presentation must be set before the viewer can be initialized.

Returns whether the initialization succeeded.

See also running, Q3DSPresentation::source, and presentation().

[override virtual protected] void Q3DSWidget::initializeGL()

Reimplemented from QOpenGLWidget::initializeGL().

[override virtual protected] void Q3DSWidget::keyPressEvent(QKeyEvent *event)

Reimplemented from QWidget::keyPressEvent().

[override virtual protected] void Q3DSWidget::keyReleaseEvent(QKeyEvent *event)

Reimplemented from QWidget::keyReleaseEvent().

[override virtual protected] void Q3DSWidget::mouseMoveEvent(QMouseEvent *event)

Reimplemented from QWidget::mouseMoveEvent().

[override virtual protected] void Q3DSWidget::mousePressEvent(QMouseEvent *event)

Reimplemented from QWidget::mousePressEvent().

[override virtual protected] void Q3DSWidget::mouseReleaseEvent(QMouseEvent *event)

Reimplemented from QWidget::mouseReleaseEvent().

[override virtual protected] void Q3DSWidget::paintGL()

Reimplemented from QOpenGLWidget::paintGL().

Q3DSPresentation *Q3DSWidget::presentation() const

Returns the presentation object used by the Q3DSWidget.

[slot] void Q3DSWidget::reset()

Deallocates and recreates all resources of the viewer and sets the presentation time back to the beginning.

[override virtual protected] void Q3DSWidget::resizeGL(int w, int h)

Reimplemented from QOpenGLWidget::resizeGL().

Q3DSViewerSettings *Q3DSWidget::settings() const

Returns the settings object used by the Q3DSWidget.

[slot] void Q3DSWidget::shutdown()

Deallocates all resources of the viewer.

[override virtual protected] void Q3DSWidget::wheelEvent(QWheelEvent *event)

Reimplemented from QWidget::wheelEvent().

Available under certain Qt licenses.
Find out more.