- Qt 6.8
- Qt Graphs
- Qt Graphs C++ Classes for 3D
- QtGraphs3D Namespace
- Qt Graphs | Commercial or GPLv3

# QtGraphs3D Namespace

The QtGraphs3D module provides enums used by QtGraphs' 3D API. More...

Header: | `#include <QtGraphs3D>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Graphs)` `target_link_libraries(mytarget PRIVATE Qt6::Graphs)`
qmake: | `QT += graphs`

- QtGraphs3D is part of Qt Graphs C++ Classes for 3D.

## Types

enum class | CameraPreset { NoPreset, FrontLow, Front, FrontHigh, LeftLow, …, DirectlyBelow }
enum class | ElementType { None, Series, AxisXLabel, AxisYLabel, AxisZLabel, CustomItem }
enum class | GridLineType { Shader, Geometry }
enum class | OptimizationHint { Default, Legacy }
enum class | RenderingMode { DirectToBackground, Indirect }

## Functions

int | qDefaultSurfaceFormat(bool antialias)

## Detailed Description

## Type Documentation

### enum class QtGraphs3D::CameraPreset

Predefined positions for camera.

Constant | Value | Description
--- | --- | ---
`QtGraphs3D::CameraPreset::NoPreset` | `0` | Used to indicate a preset has not been set, or the scene has been rotated freely.
`QtGraphs3D::CameraPreset::FrontLow` | `1` | Both x and y rotations of the camera are 0.
`QtGraphs3D::CameraPreset::Front` | `2` | X rotation is 0 and y rotation is 22.5 degrees.
`QtGraphs3D::CameraPreset::FrontHigh` | `3` | X rotation is 0 and y rotation is 45 degrees.
`QtGraphs3D::CameraPreset::LeftLow` | `4` | X rotation is 90 and y rotation is 0 degrees.
`QtGraphs3D::CameraPreset::Left` | `5` | X rotation is 90 and y rotation is 22.5 degrees.
`QtGraphs3D::CameraPreset::LeftHigh` | `6` | X rotation is 90 and y rotation is 45 degrees.
`QtGraphs3D::CameraPreset::RightLow` | `7` | X rotation is -90 and y rotation is 0 degrees.
`QtGraphs3D::CameraPreset::Right` | `8` | X rotation is -90 and y rotation is 22.5 degrees.
`QtGraphs3D::CameraPreset::RightHigh` | `9` | X rotation is -90 and y rotation is 45 degrees.
`QtGraphs3D::CameraPreset::BehindLow` | `10` | X rotation is 180 and y rotation is 0 degrees.
`QtGraphs3D::CameraPreset::Behind` | `11` | X rotation is 180 and y rotation is 22.5 degrees.
`QtGraphs3D::CameraPreset::BehindHigh` | `12` | X rotation is 180 and y rotation is 45 degrees.
`QtGraphs3D::CameraPreset::IsometricLeft` | `13` | X rotation is 45 and y rotation is 22.5 degrees.
`QtGraphs3D::CameraPreset::IsometricLeftHigh` | `14` | X rotation is 45 and y rotation is 45 degrees.
`QtGraphs3D::CameraPreset::IsometricRight` | `15` | X rotation is -45 and y rotation is 22.5 degrees.
`QtGraphs3D::CameraPreset::IsometricRightHigh` | `16` | X rotation is -45 and y rotation is 45 degrees.
`QtGraphs3D::CameraPreset::DirectlyAbove` | `17` | X rotation is 0 and y rotation is 90 degrees.
`QtGraphs3D::CameraPreset::DirectlyAboveCW45` | `18` | X rotation is -45 and y rotation is 90 degrees.
`QtGraphs3D::CameraPreset::DirectlyAboveCCW45` | `19` | X rotation is 45 and y rotation is 90 degrees.
`QtGraphs3D::CameraPreset::FrontBelow` | `20` | X rotation is 0 and y rotation is -45 degrees. In Q3DBarsWidgetItem from FrontBelow onward these only work for graphs including negative values. They act as CameraPreset...Low for positive-only values.
`QtGraphs3D::CameraPreset::LeftBelow` | `21` | X rotation is 90 and y rotation is -45 degrees.
`QtGraphs3D::CameraPreset::RightBelow` | `22` | X rotation is -90 and y rotation is -45 degrees.
`QtGraphs3D::CameraPreset::BehindBelow` | `23` | X rotation is 180 and y rotation is -45 degrees.
`QtGraphs3D::CameraPreset::DirectlyBelow` | `24` | X rotation is 0 and y rotation is -90 degrees. Acts as FrontLow for positive-only bars.

### enum class QtGraphs3D::ElementType

Type of an element in the graph.

Constant | Value | Description
--- | --- | ---
`QtGraphs3D::ElementType::None` | `0` | No defined element.
`QtGraphs3D::ElementType::Series` | `1` | An item in a series.
`QtGraphs3D::ElementType::AxisXLabel` | `2` | The x-axis label.
`QtGraphs3D::ElementType::AxisYLabel` | `3` | The y-axis label.
`QtGraphs3D::ElementType::AxisZLabel` | `4` | The z-axis label.
`QtGraphs3D::ElementType::CustomItem` | `5` | A custom item.

### enum class QtGraphs3D::GridLineType

Constant | Value | Description
--- | --- | ---
`QtGraphs3D::GridLineType::Shader` | `0` | Grid lines are rendered with GPU in a shader.
`QtGraphs3D::GridLineType::Geometry` | `1` | Grid lines are rendered with 3D models.

### enum class QtGraphs3D::OptimizationHint

The optimization hint for rendering.

Constant | Value | Description
--- | --- | ---
`QtGraphs3D::OptimizationHint::Default` | `0` | Provides the full feature set with instancing at a good performance.
`QtGraphs3D::OptimizationHint::Legacy` | `1` | Provides the full feature set at a reasonable performance. To be used if OptimizationHint.Default performs poorly or does not work.

### enum class QtGraphs3D::RenderingMode

Constant | Value | Description
--- | --- | ---

`QtGraphs3D::RenderingMode::DirectToBackground`

`0`

Indicates that the graph will be rendered directly on the window background and QML items are rendered on top of it. Using non-transparent QML item as a background will hide the graph. Clears the whole window before rendering the graph, including the areas outside the graph. If the surface format of the window supports antialiasing, it will be used (see `qDefaultSurfaceFormat()`). This rendering mode offers the best performance at the expense of non-standard QML behavior. For example, the graphs do not obey the z ordering of QML items and the opacity value has no effect on them.

`QtGraphs3D::RenderingMode::Indirect`

`1`

Indicates the graph will be first rendered to an offscreen surface that is then drawn during normal QML item rendering. The rendered image is antialiased using the multisampling method if it is supported in the current environment and the msaaSamples property value is greater than zero. This rendering mode offers good quality and normal QML item behavior at the expense of performance.

## Function Documentation

### int qDefaultSurfaceFormat(bool antialias)

This convenience function can be used to create a custom surface format suitable for use by Qt Graphs graphs.

The antialias parameter specifies whether or not antialiasing is activated.

Give the surface format returned by this function to the graph constructor (C++) or set it as the window format for QQuickView (QML) before calling `show()` on it.

For example, disable antialiasing on C++ application:

     #include <QtGraphs/qutils.h>

     // ...

     Q3DBars *graph = new Q3DBars(qDefaultSurfaceFormat(false));

For example, enable antialiasing for direct rendering modes on QML application:

     #include <QtGraphs/qutils.h>

     // ...

     QQuickView viewer;
     viewer.setFormat(qDefaultSurfaceFormat(true));