Q3DScene Class

Q3DScene class provides description of the 3D scene being visualized. More...

Header: #include <Q3DScene>
Since: QtDataVisualization 1.0
Instantiated By: Scene3D
Inherits: QObject

Properties

  • 1 property inherited from QObject

Public Functions

Q3DScene(QObject *parent = Q_NULLPTR)
virtual ~Q3DScene()
Q3DCamera *activeCamera() const
Q3DLight *activeLight() const
float devicePixelRatio() const
QPoint graphPositionQuery() const
bool isPointInPrimarySubView(const QPoint &point)
bool isPointInSecondarySubView(const QPoint &point)
bool isSecondarySubviewOnTop() const
bool isSlicingActive() const
QRect primarySubViewport() const
QRect secondarySubViewport() const
QPoint selectionQueryPosition() const
void setActiveCamera(Q3DCamera *camera)
void setActiveLight(Q3DLight *light)
void setDevicePixelRatio(float pixelRatio)
void setGraphPositionQuery(const QPoint &point)
void setPrimarySubViewport(const QRect &primarySubViewport)
void setSecondarySubViewport(const QRect &secondarySubViewport)
void setSecondarySubviewOnTop(bool isSecondaryOnTop)
void setSelectionQueryPosition(const QPoint &point)
void setSlicingActive(bool isSlicing)
QRect viewport() const
  • 31 public functions inherited from QObject

Signals

void activeCameraChanged(Q3DCamera *camera)
void activeLightChanged(Q3DLight *light)
void devicePixelRatioChanged(float pixelRatio)
void graphPositionQueryChanged(const QPoint &position)
void primarySubViewportChanged(const QRect &subViewport)
void secondarySubViewportChanged(const QRect &subViewport)
void secondarySubviewOnTopChanged(bool isSecondaryOnTop)
void selectionQueryPositionChanged(const QPoint &position)
void slicingActiveChanged(bool isSlicingActive)
void viewportChanged(const QRect &viewport)

Static Public Members

  • 11 static public members inherited from QObject

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

Q3DScene class provides description of the 3D scene being visualized.

The 3D scene contains a single active camera and a single active light source. Visualized data is assumed to be at a fixed location.

The 3D scene also keeps track of the viewport in which visualization rendering is done, the primary subviewport inside the viewport where the main 3D data visualization view resides and the secondary subviewport where the 2D sliced view of the data resides. The subviewports are by default resized by the Q3DScene. To override the resize behavior you need to listen to both viewportChanged() and slicingActiveChanged() signals and recalculate the subviewports accordingly.

Also the scene has flag for tracking if the secondary 2D slicing view is currently active or not.

Note: Not all visualizations support the secondary 2D slicing view.

Property Documentation

activeCamera : Q3DCamera *

This property contains the currently active camera in the 3D scene. When a new Q3DCamera objects is set in the property it gets automatically added as child of the scene.

Access functions:

Q3DCamera *activeCamera() const
void setActiveCamera(Q3DCamera *camera)

Notifier signal:

void activeCameraChanged(Q3DCamera *camera)

activeLight : Q3DLight *

This property contains the currently active light in the 3D scene. When a new Q3DLight objects is set in the property it gets automatically added as child of the scene.

Access functions:

Q3DLight *activeLight() const
void setActiveLight(Q3DLight *light)

Notifier signal:

void activeLightChanged(Q3DLight *light)

devicePixelRatio : float

This property contains the current device pixel ratio that is used when mapping input coordinates to pixel coordinates.

Access functions:

float devicePixelRatio() const
void setDevicePixelRatio(float pixelRatio)

Notifier signal:

void devicePixelRatioChanged(float pixelRatio)

graphPositionQuery : QPoint

This property contains the coordinates for the user input that should be processed by the scene as a graph position query. If this is set to value other than invalidSelectionPoint(), the graph tries to match a graph position to the given point within the primary viewport. After the rendering pass this property is returned to its default state of invalidSelectionPoint(). The queried graph position can be read from QAbstract3DGraph::queriedGraphPosition property after the next render pass.

There isn't a single correct 3D coordinate to match to each specific screen position, so to be consistent, the queries are always done against the inner sides of an invisible box surrounding the graph.

Note: Bar graphs allow graph position queries only at the graph floor level.

Access functions:

QPoint graphPositionQuery() const
void setGraphPositionQuery(const QPoint &point)

Notifier signal:

void graphPositionQueryChanged(const QPoint &position)

See also QAbstract3DGraph::queriedGraphPosition.

primarySubViewport : QRect

This property contains the current subviewport rectangle inside the viewport where the primary view of the data visualization is targeted to.

Access functions:

QRect primarySubViewport() const
void setPrimarySubViewport(const QRect &primarySubViewport)

Notifier signal:

void primarySubViewportChanged(const QRect &subViewport)

secondarySubViewport : QRect

This property contains the secondary viewport rectangle inside the viewport. The secondary viewport is used for drawing the 2D slice view in some visualizations.

Access functions:

QRect secondarySubViewport() const
void setSecondarySubViewport(const QRect &secondarySubViewport)

Notifier signal:

void secondarySubViewportChanged(const QRect &subViewport)

secondarySubviewOnTop : bool

This property contains whether 2D slicing view is currently drawn on top or if the 3D view is drawn on top.

Access functions:

bool isSecondarySubviewOnTop() const
void setSecondarySubviewOnTop(bool isSecondaryOnTop)

Notifier signal:

void secondarySubviewOnTopChanged(bool isSecondaryOnTop)

selectionQueryPosition : QPoint

This property contains the coordinates for the user input that should be processed by the scene as a selection. If this is set to value other than invalidSelectionPoint(), the graph tries to select a data item, axis label, or a custom item at the given point within the primary viewport. After the rendering pass the property is returned to its default state of invalidSelectionPoint().

Access functions:

QPoint selectionQueryPosition() const
void setSelectionQueryPosition(const QPoint &point)

Notifier signal:

void selectionQueryPositionChanged(const QPoint &position)

See also QAbstract3DGraph::selectedElement.

slicingActive : bool

This property contains whether 2D slicing view is currently active or not. If setting it, you must make sure QAbstract3DGraph::selectionMode has either QAbstract3DGraph::SelectionRow or QAbstract3DGraph::SelectionColumn flag set, and there is a valid selection.

Note: Not all visualizations support the 2D slicing view.

Access functions:

bool isSlicingActive() const
void setSlicingActive(bool isSlicing)

Notifier signal:

void slicingActiveChanged(bool isSlicingActive)

viewport : const QRect

This read only property contains the current viewport rectangle where all 3D rendering is targeted.

Access functions:

QRect viewport() const

Notifier signal:

void viewportChanged(const QRect &viewport)

Member Function Documentation

Q3DScene::Q3DScene(QObject *parent = Q_NULLPTR)

Constructs a basic scene with one light and one camera in it. An optional parent parameter can be given and is then passed to QObject constructor.

[virtual] Q3DScene::~Q3DScene()

Destroys the 3D scene and all the objects contained within it.

[static] QPoint Q3DScene::invalidSelectionPoint()

Returns a QPoint signifying an invalid selection position.

bool Q3DScene::isPointInPrimarySubView(const QPoint &point)

Returns whether the given point resides inside the primary subview or not. Returns true if the point is inside the primary subview.

Note: If subviews are superimposed, and the given point resides inside both, result is true only when the primary subview is on top.

bool Q3DScene::isPointInSecondarySubView(const QPoint &point)

Returns whether the given point resides inside the secondary subview or not. Returns true if the point is inside the secondary subview.

Note: If subviews are superimposed, and the given point resides inside both, result is true only when the secondary subview is on top.

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