- Qt 6.12
- Qt Graphs
- C++ Classes
- QtGraphsWidgets
- Q3DGraphsWidgetItem
- Qt Graphs | Commercial or GPLv3

# Q3DGraphsWidgetItem Class

The Q3DGraphsWidgetItem class provides a window and render loop for graphs. More...

Header: | `#include <Q3DGraphsWidgetItem>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS GraphsWidgets)` `target_link_libraries(mytarget PRIVATE Qt6::GraphsWidgets)`
qmake: | `QT += graphswidgets`
Inherits: | QObject
Inherited By: | Q3DBarsWidgetItem, Q3DScatterWidgetItem, and Q3DSurfaceWidgetItem

- List of all members, including inherited members
- Q3DGraphsWidgetItem is part of Qt Graphs C++ Classes for Widgets.

## Properties

activeTheme : QGraphsTheme* ambientLightStrength : float aspectRatio : qreal cameraPreset : QtGraphs3D::CameraPreset cameraTargetPosition : QVector3D cameraXRotation : float cameraYRotation : float cameraZoomLevel : float currentFps : int `(since 6.11)` cutoffMargin : qreal `(since 6.12)` dragMode : QtGraphs3D::DragMode gridLineType : QtGraphs3D::GridLineType horizontalAspectRatio : qreal labelMargin : float lightColor : QColor lightStrength : float locale : QLocale margin : qreal maxCameraXRotation : float maxCameraYRotation : float maxCameraZoomLevel : float measureFps : bool | minCameraXRotation : float minCameraYRotation : float minCameraZoomLevel : float msaaSamples : int optimizationHint : QtGraphs3D::OptimizationHint orthoProjection : bool `(since 6.12)` panEnabled : bool polar : bool queriedGraphPosition : QVector3D radialLabelOffset : float rotationEnabled : bool scene : Q3DScene* const selectedElement : QtGraphs3D::ElementType selectionEnabled : bool selectionMode : QtGraphs3D::SelectionFlags shadowQuality : QtGraphs3D::ShadowQuality shadowStrength : float `(since 6.9)` transparencyTechnique : QtGraphs3D::TransparencyTechnique wrapCameraXRotation : bool wrapCameraYRotation : bool zoomAtTargetEnabled : bool zoomEnabled : bool

## Public Functions

virtual | ~Q3DGraphsWidgetItem() override
QGraphsTheme * | activeTheme() const
qsizetype | addCustomItem(QCustom3DItem *item)
void | addTheme(QGraphsTheme *theme)
float | ambientLightStrength() const
qreal | aspectRatio() const
QtGraphs3D::CameraPreset | cameraPreset() const
QVector3D | cameraTargetPosition() const
float | cameraXRotation() const
float | cameraYRotation() const
float | cameraZoomLevel() const
void | clearSelection()
int | currentFps() const
QList<QCustom3DItem *> | customItems() const
qreal | cutoffMargin() const
void | doPicking(QPoint point)
void | doRayPicking(QVector3D origin, QVector3D direction)
QtGraphs3D::DragMode | dragMode() const
QtGraphs3D::GridLineType | gridLineType() const
bool | hasSeries(QAbstract3DSeries *series) const
qreal | horizontalAspectRatio() const
bool | isOrthoProjection() const
bool | isPanEnabled() const
bool | isPolar() const
bool | isRotationEnabled() const
bool | isSelectionEnabled() const
bool | isZoomAtTargetEnabled() const
bool | isZoomEnabled() const
float | labelMargin() const
QColor | lightColor() const
float | lightStrength() const
QLocale | locale() const
qreal | margin() const
float | maxCameraXRotation() const
float | maxCameraYRotation() const
float | maxCameraZoomLevel() const
bool | measureFps() const
float | minCameraXRotation() const
float | minCameraYRotation() const
float | minCameraZoomLevel() const
int | msaaSamples() const
QtGraphs3D::OptimizationHint | optimizationHint() const
QVector3D | queriedGraphPosition() const
float | radialLabelOffset() const
void | releaseCustomItem(QCustom3DItem *item)
void | releaseTheme(QGraphsTheme *theme)
void | removeCustomItem(QCustom3DItem *item)
void | removeCustomItemAt(QVector3D position)
void | removeCustomItems()
QSharedPointer<QQuickItemGrabResult> | renderToImage(QSize imageSize = QSize()) const
Q3DScene * | scene() const
QAbstract3DAxis * | selectedAxis() const
QCustom3DItem * | selectedCustomItem() const
qsizetype | selectedCustomItemIndex() const
QtGraphs3D::ElementType | selectedElement() const
int | selectedLabelIndex() const
QtGraphs3D::SelectionFlags | selectionMode() const
QtGraphs3D::ShadowQuality | shadowQuality() const
float | shadowStrength() const
QList<QGraphsTheme *> | themes() const
QtGraphs3D::TransparencyTechnique | transparencyTechnique() const
QQuickWidget * | widget() const
bool | wrapCameraXRotation() const
bool | wrapCameraYRotation() const

## Public Slots

void | setActiveTheme(QGraphsTheme *activeTheme)
void | setAmbientLightStrength(float newAmbientLightStrength)
void | setAspectRatio(qreal ratio)
void | setCameraPosition(float horizontal, float vertical, float zoom = 100.0f)
void | setCameraPreset(QtGraphs3D::CameraPreset preset)
void | setCameraTargetPosition(QVector3D target)
void | setCameraXRotation(float rotation)
void | setCameraYRotation(float rotation)
void | setCameraZoomLevel(float level)
void | setCutoffMargin(qreal margin)
void | setDragMode(QtGraphs3D::DragMode newDragMode)
void | setGridLineType(const QtGraphs3D::GridLineType &gridLineType)
void | setHorizontalAspectRatio(qreal ratio)
void | setLabelMargin(float margin)
void | setLightColor(QColor newLightColor)
void | setLightStrength(float newLightStrength)
void | setLocale(const QLocale &locale)
void | setMargin(qreal margin)
void | setMaxCameraXRotation(float rotation)
void | setMaxCameraYRotation(float rotation)
void | setMaxCameraZoomLevel(float level)
void | setMeasureFps(bool enable)
void | setMinCameraXRotation(float rotation)
void | setMinCameraYRotation(float rotation)
void | setMinCameraZoomLevel(float level)
void | setMsaaSamples(int samples)
void | setOptimizationHint(QtGraphs3D::OptimizationHint hint)
void | setOrthoProjection(bool enable)
`(since 6.12)` void | setPanButton(Qt::MouseButtons button)
void | setPanEnabled(bool enable)
void | setPolar(bool enable)
void | setRadialLabelOffset(float offset)
void | setRotationEnabled(bool enable)
void | setSelectionEnabled(bool enable)
void | setSelectionMode(const QtGraphs3D::SelectionFlags &selectionMode)
void | setShadowQuality(const QtGraphs3D::ShadowQuality &shadowQuality)
void | setShadowStrength(float newShadowStrength)
void | setTransparencyTechnique(QtGraphs3D::TransparencyTechnique technique)
void | setWidget(QQuickWidget *widget)
void | setWrapCameraXRotation(bool wrap)
void | setWrapCameraYRotation(bool wrap)
void | setZoomAtTargetEnabled(bool enable)
void | setZoomEnabled(bool enable)

## Signals

void | activeThemeChanged(QGraphsTheme *activeTheme)
void | ambientLightStrengthChanged()
void | aspectRatioChanged(qreal ratio)
void | cameraPresetChanged(QtGraphs3D::CameraPreset preset)
void | cameraTargetPositionChanged(QVector3D target)
void | cameraXRotationChanged(float rotation)
void | cameraYRotationChanged(float rotation)
void | cameraZoomLevelChanged(float zoomLevel)
void | currentFpsChanged(int fps)
void | cutoffMarginChanged(qreal newMargin)
void | dragModeChanged(QtGraphs3D::DragMode dragMode)
void | gridLineTypeChanged()
void | horizontalAspectRatioChanged(qreal ratio)
void | labelMarginChanged(float margin)
void | lightColorChanged()
void | lightStrengthChanged()
void | localeChanged(const QLocale &locale)
void | marginChanged(qreal margin)
void | maxCameraXRotationChanged(float rotation)
void | maxCameraYRotationChanged(float rotation)
void | maxCameraZoomLevelChanged(float zoomLevel)
void | measureFpsChanged(bool enabled)
void | minCameraXRotationChanged(float rotation)
void | minCameraYRotationChanged(float rotation)
void | minCameraZoomLevelChanged(float zoomLevel)
void | msaaSamplesChanged(int samples)
void | optimizationHintChanged(QtGraphs3D::OptimizationHint hint)
void | orthoProjectionChanged(bool enabled)
void | panEnabledChanged(bool enable)
void | polarChanged(bool enabled)
void | queriedGraphPositionChanged(QVector3D data)
void | radialLabelOffsetChanged(float offset)
void | rotationEnabledChanged(bool enable)
void | selectedElementChanged(QtGraphs3D::ElementType type)
void | selectionEnabledChanged(bool enable)
void | selectionModeChanged(const QtGraphs3D::SelectionFlags selectionMode)
void | shadowQualityChanged(QtGraphs3D::ShadowQuality quality)
void | shadowStrengthChanged()
void | transparencyTechniqueChanged(QtGraphs3D::TransparencyTechnique technique)
void | wrapCameraXRotationChanged(bool wrap)
void | wrapCameraYRotationChanged(bool wrap)
void | zoomAtTargetEnabledChanged(bool enable)
void | zoomEnabledChanged(bool enable)

## Detailed Description

This class subclasses a QWindow and provides render loop for graphs inheriting it.

You should not need to use this class directly, but one of its subclasses instead.

Multisampling is turned off by default in `QSurfaceFormat`. To enable multisampling, set a custom surface format as a default surface format. To get the custom surface format, use QQuick3D::idealSurfaceFormat().

See also Q3DBarsWidgetItem, Q3DScatterWidgetItem, Q3DSurfaceWidgetItem, and Qt Graphs C++ Classes for 3D.

## Property Documentation

### activeTheme : QGraphsTheme*

This property holds the active theme of the graph.

Sets activeTheme as the active theme to be used for the graph. Implicitly calls addTheme() to transfer the ownership of the theme to this graph.

If activeTheme is null, a temporary default theme is created. This temporary theme is destroyed if any theme is explicitly set later. Properties of the theme can be modified even after setting it, and the modifications take effect immediately.

Access functions:

QGraphsTheme * | activeTheme() const
void | setActiveTheme(QGraphsTheme *activeTheme)

Notifier signal:

void | activeThemeChanged(QGraphsTheme *activeTheme)

### ambientLightStrength : float

This property holds the ambient light strength for the whole graph.

This value determines how evenly and brightly the colors are shown throughout the graph regardless of the light position.

The value must be between `0.0f` and `1.0f`.

Access functions:

float | ambientLightStrength() const
void | setAmbientLightStrength(float newAmbientLightStrength)

Notifier signal:

void | ambientLightStrengthChanged()

### aspectRatio : qreal

This property holds the ratio of the graph scaling between the longest axis on the horizontal plane and the y-axis.

Defaults to `2.0`.

Note: Has no effect on Q3DBarsWidgetItem.

Access functions:

qreal | aspectRatio() const
void | setAspectRatio(qreal ratio)

Notifier signal:

void | aspectRatioChanged(qreal ratio)

See also horizontalAspectRatio.

### cameraPreset : QtGraphs3D::CameraPreset

The preset camera position that the camera is currently using. The value can be set to one of the CameraPreset enum values. This property can be used to set a predefined camera angle from where the graph is viewed.

By default, the camera preset is set to `CameraPreset::FrontLow`.

Note: If you have set the cameraXRotation, cameraYRotation or cameraZoomLevel properties, or called setCustomCamera(), this property will return CameraPreset::NoPreset until either setCameraPreset() is called again, or the preset is changed to another value.

Access functions:

QtGraphs3D::CameraPreset | cameraPreset() const
void | setCameraPreset(QtGraphs3D::CameraPreset preset)

Notifier signal:

void | cameraPresetChanged(QtGraphs3D::CameraPreset preset)

### cameraTargetPosition : QVector3D

This property holds the camera target position as a vector or vertex in the 3D space.

Defaults to `QVector3D(0.0, 0.0, 0.0)`.

Valid coordinate values are between `-1.0...1.0`, where the edge values indicate the edges of the corresponding axis range. Any values outside this range are clamped to the edge.

Access functions:

QVector3D | cameraTargetPosition() const
void | setCameraTargetPosition(QVector3D target)

Notifier signal:

void | cameraTargetPositionChanged(QVector3D target)

### cameraXRotation : float

This property holds the X-rotation angle of the camera around the target point in degrees.

Access functions:

float | cameraXRotation() const
void | setCameraXRotation(float rotation)

Notifier signal:

void | cameraXRotationChanged(float rotation)

### cameraYRotation : float

This property holds the Y-rotation angle of the camera around the target point in degrees.

Access functions:

float | cameraYRotation() const
void | setCameraYRotation(float rotation)

Notifier signal:

void | cameraYRotationChanged(float rotation)

### cameraZoomLevel : float

This property holds the camera zoom level in percentage.

The default value of `100.0f` means there is no zoom in or out set in the camera. The value is limited by the minCameraZoomLevel and maxCameraZoomLevel properties.

Access functions:

float | cameraZoomLevel() const
void | setCameraZoomLevel(float level)

Notifier signal:

void | cameraZoomLevelChanged(float zoomLevel)

See also minCameraZoomLevel and maxCameraZoomLevel.

### `[read-only]` currentFps : int

This property holds the rendering results for the last second.

The results are stored in this read-only property when FPS measuring is enabled. It takes at least a second before this value is updated after measuring is activated.

Access functions:

int | currentFps() const

Notifier signal:

void | currentFpsChanged(int fps)

See also measureFps.

### `[since 6.11]` cutoffMargin : qreal

This property holds the value used for the space between the axis limits and the position at which graph elements are culled.

Note: Does not affect bar graphs.

This enumeration was introduced in Qt 6.11.

Access functions:

qreal | cutoffMargin() const
void | setCutoffMargin(qreal margin)

Notifier signal:

void | cutoffMarginChanged(qreal newMargin)

### `[since 6.12]` dragMode : QtGraphs3D::DragMode

Determines how drag events on the graph are interpreted, one of QtGraphs3D::DragMode enum values.

Defaults to `QtGraphs3D::DragMode::Rotate`.

This enumeration was introduced in Qt 6.12.

Access functions:

QtGraphs3D::DragMode | dragMode() const
void | setDragMode(QtGraphs3D::DragMode newDragMode)

Notifier signal:

void | dragModeChanged(QtGraphs3D::DragMode dragMode)

See also panEnabled.

### gridLineType : QtGraphs3D::GridLineType

This property holds whether the grid lines type is QtGraphs3D::GridLineType::Shader or QtGraphs3D::GridLineType::Geometry.

This value affects all grid lines.

Access functions:

QtGraphs3D::GridLineType | gridLineType() const
void | setGridLineType(const QtGraphs3D::GridLineType &gridLineType)

Notifier signal:

void | gridLineTypeChanged()

See also QtGraphs3D::GridLineType.

### horizontalAspectRatio : qreal

This property holds the ratio of the graph scaling between the x-axis and z-axis.

The value of `0.0` indicates automatic scaling according to axis ranges. Defaults to `0.0`.

Has no effect on Q3DBarsWidgetItem, which handles scaling on the horizontal plane via the barThickness and barSpacing properties. Polar graphs also ignore this property.

Access functions:

qreal | horizontalAspectRatio() const
void | setHorizontalAspectRatio(qreal ratio)

Notifier signal:

void | horizontalAspectRatioChanged(qreal ratio)

See also aspectRatio, polar, Q3DBarsWidgetItem::barThickness, and Q3DBarsWidgetItem::barSpacing.

### labelMargin : float

This property specifies the margin for the placement of the axis labels.

Negative values place the labels inside the plot-area while positive values place them outside the plot-area. Label automatic rotation is disabled when the value is negative. Defaults to `0.1`

Access functions:

float | labelMargin() const
void | setLabelMargin(float margin)

Notifier signal:

void | labelMarginChanged(float margin)

See also QAbstract3DAxis::labelAutoAngle.

### lightColor : QColor

This property holds the color for the ambient and specular light.

This value affects the light specified in Q3DScene.

Access functions:

QColor | lightColor() const
void | setLightColor(QColor newLightColor)

Notifier signal:

void | lightColorChanged()

### lightStrength : float

This property holds the specular light strength for the whole graph.

The value must be between `0.0f` and `10.0f`.

This value affects the light specified in Q3DScene.

Access functions:

float | lightStrength() const
void | setLightStrength(float newLightStrength)

Notifier signal:

void | lightStrengthChanged()

### locale : QLocale

This property holds the locale used for formatting various numeric labels.

Defaults to the `"C"` locale.

Access functions:

QLocale | locale() const
void | setLocale(const QLocale &locale)

Notifier signal:

void | localeChanged(const QLocale &locale)

See also QValue3DAxis::labelFormat.

### margin : qreal

This property holds the absolute value used for the space left between the edge of the plottable graph area and the edge of the graph background.

If the margin value is negative, the margins are determined automatically and can vary according to the size of the items in the series and the type of the graph. The value is interpreted as a fraction of the y-axis range if the graph aspect ratios have not been changed from the default values. Defaults to `-1.0`.

Note: Setting a smaller margin for a scatter graph than the automatically determined margin can cause the scatter items at the edges of the graph to overlap with the graph background.

Note: On scatter and surface graphs, if the margin is small in comparison to the axis label size, the positions of the edge labels of the axes are adjusted to avoid overlap with the edge labels of the neighboring axes.

Access functions:

qreal | margin() const
void | setMargin(qreal margin)

Notifier signal:

void | marginChanged(qreal margin)

### maxCameraXRotation : float

This property holds the maximum X-rotation angle of the camera around the target point in degrees. The default value is `180.0`

Access functions:

float | maxCameraXRotation() const
void | setMaxCameraXRotation(float rotation)

Notifier signal:

void | maxCameraXRotationChanged(float rotation)

### maxCameraYRotation : float

This property holds the maximum Y-rotation angle of the camera around the target point in degrees. The default value is `90.0`

Access functions:

float | maxCameraYRotation() const
void | setMaxCameraYRotation(float rotation)

Notifier signal:

void | maxCameraYRotationChanged(float rotation)

### maxCameraZoomLevel : float

This property holds the maximum allowed camera zoom level.

If the maximum level is set to a new value that is lower than the existing minimum level, the minimum level is adjusted to the new maximum as well. If the current cameraZoomLevel is outside the new bounds, it is adjusted as well. Defaults to `500.0f`.

Access functions:

float | maxCameraZoomLevel() const
void | setMaxCameraZoomLevel(float level)

Notifier signal:

void | maxCameraZoomLevelChanged(float zoomLevel)

See also cameraZoomLevel and minCameraZoomLevel.

### measureFps : bool

This property holds whether rendering is done continuously instead of on demand.

If `true`, rendering is continuous and the value of the currentFps property is updated. Defaults to `false`.

Access functions:

bool | measureFps() const
void | setMeasureFps(bool enable)

Notifier signal:

void | measureFpsChanged(bool enabled)

See also currentFps.

### minCameraXRotation : float

This property holds the minimum X-rotation angle of the camera around the target point in degrees. The default value is `-180.0`

Access functions:

float | minCameraXRotation() const
void | setMinCameraXRotation(float rotation)

Notifier signal:

void | minCameraXRotationChanged(float rotation)

### minCameraYRotation : float

This property holds the minimum Y-rotation angle of the camera around the target point in degrees. The default value is `0.0`

Access functions:

float | minCameraYRotation() const
void | setMinCameraYRotation(float rotation)

Notifier signal:

void | minCameraYRotationChanged(float rotation)

### minCameraZoomLevel : float

This property holds the minimum allowed camera zoom level.

If the minimum level is set to a new value that is higher than the existing maximum level, the maximum level is adjusted to the new minimum as well. If the current zoomLevel is outside the new bounds, it is adjusted as well. The minCameraZoomLevel cannot be set below `1.0f`. Defaults to `10.0f`.

Access functions:

float | minCameraZoomLevel() const
void | setMinCameraZoomLevel(float level)

Notifier signal:

void | minCameraZoomLevelChanged(float zoomLevel)

See also cameraZoomLevel and maxCameraZoomLevel.

### msaaSamples : int

This property holds the number of used samples in MSAA.

Sets the number of used MSAA samples to samples. The number of samples can be either 0, 2, 4, or 8.

Access functions:

int | msaaSamples() const
void | setMsaaSamples(int samples)

Notifier signal:

void | msaaSamplesChanged(int samples)

### optimizationHint : QtGraphs3D::OptimizationHint

Specifies whether the default or legacy mode is used for rendering optimization.

The default mode uses instanced rendering, and provides the full feature set at the best level of performance on most systems. The static mode optimizes graph rendering and is ideal for large non-changing data sets. It is slower with dynamic data changes and item rotations. Selection is not optimized, so using the static mode with massive data sets is not advisable. Static optimization works only on scatter graphs. Legacy mode renders all items in th graph individually, without instancing. It should be used only if default mode does not work, i.e. if the target system does not support instancing. Defaults to QtGraphs3D::OptimizationHint::Default.

Note: On some environments, large graphs using static optimization may not render, because all of the items are rendered using a single draw call, and different graphics drivers support different maximum vertice counts per call. This is mostly an issue on 32bit and OpenGL ES2 platforms. To work around this issue, choose an item mesh with a low vertex count or use the point mesh.

Access functions:

QtGraphs3D::OptimizationHint | optimizationHint() const
void | setOptimizationHint(QtGraphs3D::OptimizationHint hint)

Notifier signal:

void | optimizationHintChanged(QtGraphs3D::OptimizationHint hint)

See also QAbstract3DSeries::mesh.

### orthoProjection : bool

This property holds whether orthographic projection is used for displaying the graph.

Defaults to `false`.

Note: Shadows will be disabled when set to `true`.

Access functions:

bool | isOrthoProjection() const
void | setOrthoProjection(bool enable)

Notifier signal:

void | orthoProjectionChanged(bool enabled)

See also QAbstract3DAxis::labelAutoAngle.

### `[since 6.12]` panEnabled : bool

This property holds whether this input handler allows graph panning.

Defaults to `true`.

This enumeration was introduced in Qt 6.12.

Access functions:

bool | isPanEnabled() const
void | setPanEnabled(bool enable)

Notifier signal:

void | panEnabledChanged(bool enable)

See also dragMode and setPanButton().

### polar : bool

This property holds whether horizontal axes are changed into polar axes.

If `true`, the x-axis becomes the angular axis and the z-axis becomes the radial axis. Polar mode is not available for bar graphs.

Defaults to `false`.

Access functions:

bool | isPolar() const
void | setPolar(bool enable)

Notifier signal:

void | polarChanged(bool enabled)

See also orthoProjection and radialLabelOffset.

### `[read-only]` queriedGraphPosition : QVector3D

This property holds the latest queried graph position values along each axis.

This read-only property contains the results from Q3DScene::graphPositionQuery. The values are normalized to the range `[-1, 1]`. If the queried position was outside the graph bounds, the values will not reflect the real position, but will instead indicate an undefined position outside the range `[-1, 1]`. The value will be undefined until a query is made.

There is no single correct 3D coordinate to match a particular 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 only allow querying graph position at the graph floor level, so the y-value is always zero for bar graphs and the valid queries can be only made at screen positions that contain the floor of the graph.

Access functions:

QVector3D | queriedGraphPosition() const

Notifier signal:

void | queriedGraphPositionChanged(QVector3D data)

See also Q3DScene::graphPositionQuery.

### radialLabelOffset : float

This property holds the normalized horizontal offset for the axis labels of the radial polar axis.

The value `0.0` indicates that the labels should be drawn next to the 0-angle angular axis grid line. The value `1.0` indicates that the labels are drawn in their usual place at the edge of the graph background. Defaults to `1.0`.

This property is ignored if the polar property value is `false`.

Access functions:

float | radialLabelOffset() const
void | setRadialLabelOffset(float offset)

Notifier signal:

void | radialLabelOffsetChanged(float offset)

See also polar.

### rotationEnabled : bool

This property holds whether this input handler allows graph rotation.

Defaults to `true`.

Access functions:

bool | isRotationEnabled() const
void | setRotationEnabled(bool enable)

Notifier signal:

void | rotationEnabledChanged(bool enable)

### `[read-only]` scene : Q3DScene* const

This property holds the Q3DScene pointer that can be used to manipulate the scene and access the scene elements.

This property is read-only.

Access functions:

Q3DScene * | scene() const

### `[read-only]` selectedElement : QtGraphs3D::ElementType

This property holds the element selected in the graph.

This property can be used to query the selected element type. The type is valid until a new selection is made in the graph and the `selectedElementChanged` signal is emitted.

The signal can be used for example for implementing custom input handlers, as demonstrated in the Graph Gallery example under Scatter Graph tab.

Access functions:

QtGraphs3D::ElementType | selectedElement() const

Notifier signal:

void | selectedElementChanged(QtGraphs3D::ElementType type)

See also selectedLabelIndex(), selectedAxis(), selectedCustomItemIndex(), selectedCustomItem(), Q3DBarsWidgetItem::selectedSeries(), Q3DScatterWidgetItem::selectedSeries(), Q3DSurfaceWidgetItem::selectedSeries(), and Q3DScene::setSelectionQueryPosition().

### selectionEnabled : bool

This property holds whether this input handler allows selection from the graph.

Defaults to `true`.

Access functions:

bool | isSelectionEnabled() const
void | setSelectionEnabled(bool enable)

Notifier signal:

void | selectionEnabledChanged(bool enable)

### selectionMode : QtGraphs3D::SelectionFlags

Item selection mode.

A combination of SelectionFlags. By default, `Item`. Different graph types support different selection modes.

Access functions:

QtGraphs3D::SelectionFlags | selectionMode() const
void | setSelectionMode(const QtGraphs3D::SelectionFlags &selectionMode)

Notifier signal:

void | selectionModeChanged(const QtGraphs3D::SelectionFlags selectionMode)

See also QtGraphs3D::SelectionFlags.

### shadowQuality : QtGraphs3D::ShadowQuality

This property holds the quality of the shadow.

One of the ShadowQuality enum values. By default, `Medium`.

Note: If setting the shadow quality to a certain level fails, the level is lowered until it is successfully set. The `shadowQualityChanged` signal is emitted each time a change is made.

Access functions:

QtGraphs3D::ShadowQuality | shadowQuality() const
void | setShadowQuality(const QtGraphs3D::ShadowQuality &shadowQuality)

Notifier signal:

void | shadowQualityChanged(QtGraphs3D::ShadowQuality quality)

See also QtGraphs3D::ShadowQuality.

### shadowStrength : float

This property holds the shadow strength for the whole graph.

The higher the number, the darker the shadows will be. The value must be between `0.0` and `100.0`.

This value affects the light specified in Q3DScene.

Access functions:

float | shadowStrength() const
void | setShadowStrength(float newShadowStrength)

Notifier signal:

void | shadowStrengthChanged()

### `[since 6.9]` transparencyTechnique : QtGraphs3D::TransparencyTechnique

Specifies which transparency technique to use. The Default value is `Default`. When rendering transparent surface graphs, use `Approximate` or `Accurate`. `Default` should be used for other graph types.

Constant | Description
--- | ---
`Default` | Indicates that order-independent transparency techniques are not used. Offers the best performance. Use when graphs don't contain transparency or when a bar or scatter graph is also using instancing, that is optimizationHint is {QtGraphs3D::OptimizationHint::Default}.
`Approximate` | Indicates that a graph attempts an approximation of order-independent transparency. This method is faster than `Accurate` and works on older hardware but may yield inaccurate results. Use when the order-independent transparency is needed, but the performance cost has to be lower than when using accurate order-independent transparency.
`Accurate` | Indicates that accurate order-independent transparency is used. Use when perfect transparency rendering is needed.

This enumeration was introduced in Qt 6.9.

Access functions:

QtGraphs3D::TransparencyTechnique | transparencyTechnique() const
void | setTransparencyTechnique(QtGraphs3D::TransparencyTechnique technique)

Notifier signal:

void | transparencyTechniqueChanged(QtGraphs3D::TransparencyTechnique technique)

See also QtGraphs3D::TransparencyTechnique.

### wrapCameraXRotation : bool

This property holds the behavior of the minimum and maximum limits in the X-rotation.

If set to `true`, the X-rotation of the camera is wrapped from minimum to maximum and from maximum to minimum. If set to `false`, the X-rotation of the camera is limited to the sector determined by the minimum and maximum values. Set to `true` by default.

Access functions:

bool | wrapCameraXRotation() const
void | setWrapCameraXRotation(bool wrap)

Notifier signal:

void | wrapCameraXRotationChanged(bool wrap)

### wrapCameraYRotation : bool

This property holds the behavior of the minimum and maximum limits in the Y-rotation.

If `true`, the Y-rotation of the camera is wrapped from minimum to maximum and from maximum to minimum. If `false`, the Y-rotation of the camera is limited to the sector determined by the minimum and maximum values. Set to `true` by default.

Access functions:

bool | wrapCameraYRotation() const
void | setWrapCameraYRotation(bool wrap)

Notifier signal:

void | wrapCameraYRotationChanged(bool wrap)

### zoomAtTargetEnabled : bool

This property holds whether zooming should change the camera target so that the zoomed point of the graph stays at the same location after the zoom.

Defaults to `true`.

Access functions:

bool | isZoomAtTargetEnabled() const
void | setZoomAtTargetEnabled(bool enable)

Notifier signal:

void | zoomAtTargetEnabledChanged(bool enable)

### zoomEnabled : bool

This property holds whether this input handler allows graph zooming.

Defaults to `true`.

Access functions:

bool | isZoomEnabled() const
void | setZoomEnabled(bool enable)

Notifier signal:

void | zoomEnabledChanged(bool enable)

## Member Function Documentation

### `[override virtual noexcept]` Q3DGraphsWidgetItem::~Q3DGraphsWidgetItem()

Destroys Q3DGraphsWidgetItem.

### qsizetype Q3DGraphsWidgetItem::addCustomItem(QCustom3DItem *item)

Adds a QCustom3DItem item to the graph. Graph takes ownership of the added item.

Returns the index to the added item if the add operation was successful, -1 if trying to add a null item, and the index of the item if trying to add an already added item.

Items are rendered in the order they have been inserted. The rendering order needs to be taken into account when having solid and transparent items.

See also removeCustomItems(), removeCustomItem(), removeCustomItemAt(), and customItems().

### void Q3DGraphsWidgetItem::addTheme(QGraphsTheme *theme)

Adds the given theme to the graph. The themes added via addTheme are not taken in to use directly. Only the ownership of the theme is given to the graph. The theme must not be null or already added to another graph.

See also releaseTheme() and setActiveTheme().

### void Q3DGraphsWidgetItem::clearSelection()

Clears selection from all attached series.

### QList<QCustom3DItem *> Q3DGraphsWidgetItem::customItems() const

Returns the list of all added custom items.

See also addCustomItem().

### void Q3DGraphsWidgetItem::doPicking(QPoint point)

Performs picking using view coordinates from point on the elements of the graph, selecting the first item hit. Default input handling performs this upon receiving the onTapped event.

See also selectedElement.

### void Q3DGraphsWidgetItem::doRayPicking(QVector3D origin, QVector3D direction)

Performs picking starting from origin and in direction on the elements of the graph, selecting the first item hit.

See also selectedElement.

### bool Q3DGraphsWidgetItem::hasSeries(QAbstract3DSeries *series) const

Returns whether the series has already been added to the graph.

### void Q3DGraphsWidgetItem::releaseCustomItem(QCustom3DItem *item)

Gets ownership of given item back and removes the item from the graph.

Note: If the same item is added back to the graph, the texture or the texture file needs to be re-set.

See also QCustom3DItem::setTextureImage() and QCustom3DItem::setTextureFile().

### void Q3DGraphsWidgetItem::releaseTheme(QGraphsTheme *theme)

Releases the ownership of the theme back to the caller, if it was added to this graph. If the released theme is in use, a new default theme will be created and set active.

If the default theme is released and added back later, it behaves as any other theme would.

See also addTheme() and setActiveTheme().

### void Q3DGraphsWidgetItem::removeCustomItem(QCustom3DItem *item)

Removes the custom item. Deletes the resources allocated to it.

### void Q3DGraphsWidgetItem::removeCustomItemAt(QVector3D position)

Removes all custom items at position. Deletes the resources allocated to them.

### void Q3DGraphsWidgetItem::removeCustomItems()

Removes all custom items. Deletes the resources allocated to them.

### QSharedPointer<QQuickItemGrabResult> Q3DGraphsWidgetItem::renderToImage(QSize imageSize = QSize()) const

Renders current frame to an image of imageSize. Returns a shared pointer to grab result which can be used to access the rendered image when it's ready. Image is rendered with the current antialiasing settings.

See also QQuickItem::grabToImage().

### QAbstract3DAxis *Q3DGraphsWidgetItem::selectedAxis() const

Can be used to get the selected axis after receiving `selectedElementChanged` signal with any label type. Selection is valid until the next `selectedElementChanged` signal.

Returns the pointer to the selected axis, or null.

See also selectedElement.

### QCustom3DItem *Q3DGraphsWidgetItem::selectedCustomItem() const

Can be used to get the selected custom item after receiving `selectedElementChanged` signal with Q3DGraphsWidgetItem::ElementType::CustomItem type. Ownership of the item remains with the graph. Selection is valid until the next `selectedElementChanged` signal.

Returns the pointer to the selected custom item, or null.

See also selectedElement.

### qsizetype Q3DGraphsWidgetItem::selectedCustomItemIndex() const

Can be used to query the index of the selected custom item after receiving `selectedElementChanged` signal with Q3DGraphsWidgetItem::ElementType::CustomItem type. Selection is valid until the next `selectedElementChanged` signal.

Returns the index of the selected custom item, or -1.

See also selectedElement.

### int Q3DGraphsWidgetItem::selectedLabelIndex() const

Can be used to query the index of the selected label after receiving `selectedElementChanged` signal with any label type. Selection is valid until the next `selectedElementChanged` signal.

Returns the index of the selected label, or -1.

See also selectedElement.

### `[slot]` void Q3DGraphsWidgetItem::setCameraPosition(float horizontal, float vertical, float zoom = 100.0f)

Utility function that sets the camera rotations and distance.horizontal and vertical define the camera rotations to be used. Optional zoom parameter can be given to set the zoom percentage of the camera within the bounds defined by minCameraZoomLevel and maxCameraZoomLevel properties.

### `[slot, since 6.12]` void Q3DGraphsWidgetItem::setPanButton(Qt::MouseButtons button)

Sets the mouse button used to trigger panning in 3D graphs.

This function was introduced in Qt 6.12.

See also panEnabled.

### `[slot]` void Q3DGraphsWidgetItem::setWidget(QQuickWidget *widget)

Sets the given widget instance to be used as the QQuickWidget for the widget item. The graph is set as the content of the QQuickWidget.

Graphs can only be rendered in widget applications using QQuickWidgets.

Usage example:

     QQuickWidget quickwidget;
     Q3DBarsWidgetItem graph;
     graph.setWidget(&quickwidget);

See also widget().

### QList<QGraphsTheme *> Q3DGraphsWidgetItem::themes() const

Returns the list of all added themes.

See also addTheme().

### QQuickWidget *Q3DGraphsWidgetItem::widget() const

Returns a pointer to the QQuickWidget instance that has been set for the widget item.

See also setWidget().