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

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 }
enum class SelectionFlag { None, Item, Row, ItemAndRow, Column, …, MultiSeries }
flags SelectionFlags
enum class ShadowQuality { None, Low, Medium, High, SoftLow, …, SoftHigh }

Functions

QSurfaceFormat qDefaultSurfaceFormat(bool antialias)

Detailed Description

Type Documentation

enum class QtGraphs3D::CameraPreset

Predefined positions for camera.

ConstantValueDescription
QtGraphs3D::CameraPreset::NoPreset0Used to indicate a preset has not been set, or the scene has been rotated freely.
QtGraphs3D::CameraPreset::FrontLow1Both x and y rotations of the camera are 0.
QtGraphs3D::CameraPreset::Front2X rotation is 0 and y rotation is 22.5 degrees.
QtGraphs3D::CameraPreset::FrontHigh3X rotation is 0 and y rotation is 45 degrees.
QtGraphs3D::CameraPreset::LeftLow4X rotation is 90 and y rotation is 0 degrees.
QtGraphs3D::CameraPreset::Left5X rotation is 90 and y rotation is 22.5 degrees.
QtGraphs3D::CameraPreset::LeftHigh6X rotation is 90 and y rotation is 45 degrees.
QtGraphs3D::CameraPreset::RightLow7X rotation is -90 and y rotation is 0 degrees.
QtGraphs3D::CameraPreset::Right8X rotation is -90 and y rotation is 22.5 degrees.
QtGraphs3D::CameraPreset::RightHigh9X rotation is -90 and y rotation is 45 degrees.
QtGraphs3D::CameraPreset::BehindLow10X rotation is 180 and y rotation is 0 degrees.
QtGraphs3D::CameraPreset::Behind11X rotation is 180 and y rotation is 22.5 degrees.
QtGraphs3D::CameraPreset::BehindHigh12X rotation is 180 and y rotation is 45 degrees.
QtGraphs3D::CameraPreset::IsometricLeft13X rotation is 45 and y rotation is 22.5 degrees.
QtGraphs3D::CameraPreset::IsometricLeftHigh14X rotation is 45 and y rotation is 45 degrees.
QtGraphs3D::CameraPreset::IsometricRight15X rotation is -45 and y rotation is 22.5 degrees.
QtGraphs3D::CameraPreset::IsometricRightHigh16X rotation is -45 and y rotation is 45 degrees.
QtGraphs3D::CameraPreset::DirectlyAbove17X rotation is 0 and y rotation is 90 degrees.
QtGraphs3D::CameraPreset::DirectlyAboveCW4518X rotation is -45 and y rotation is 90 degrees.
QtGraphs3D::CameraPreset::DirectlyAboveCCW4519X rotation is 45 and y rotation is 90 degrees.
QtGraphs3D::CameraPreset::FrontBelow20X 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::LeftBelow21X rotation is 90 and y rotation is -45 degrees.
QtGraphs3D::CameraPreset::RightBelow22X rotation is -90 and y rotation is -45 degrees.
QtGraphs3D::CameraPreset::BehindBelow23X rotation is 180 and y rotation is -45 degrees.
QtGraphs3D::CameraPreset::DirectlyBelow24X 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.

ConstantValueDescription
QtGraphs3D::ElementType::None0No defined element.
QtGraphs3D::ElementType::Series1An item in a series.
QtGraphs3D::ElementType::AxisXLabel2The x-axis label.
QtGraphs3D::ElementType::AxisYLabel3The y-axis label.
QtGraphs3D::ElementType::AxisZLabel4The z-axis label.
QtGraphs3D::ElementType::CustomItem5A custom item.

enum class QtGraphs3D::GridLineType

ConstantValueDescription
QtGraphs3D::GridLineType::Shader0Grid lines are rendered with GPU in a shader.
QtGraphs3D::GridLineType::Geometry1Grid lines are rendered with 3D models.

enum class QtGraphs3D::OptimizationHint

The optimization hint for rendering.

ConstantValueDescription
QtGraphs3D::OptimizationHint::Default0Provides the full feature set with instancing at a good performance.
QtGraphs3D::OptimizationHint::Legacy1Provides the full feature set at a reasonable performance. To be used if OptimizationHint.Default performs poorly or does not work.

enum class QtGraphs3D::RenderingMode

ConstantValueDescription
QtGraphs3D::RenderingMode::DirectToBackground0Indicates 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::Indirect1Indicates 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.

enum class QtGraphs3D::SelectionFlag
flags QtGraphs3D::SelectionFlags

Item selection modes. Values of this enumeration can be combined with OR operator.

ConstantValueDescription
QtGraphs3D::SelectionFlag::None0x00Selection mode disabled.
QtGraphs3D::SelectionFlag::Item0x01Selection highlights a single item.
QtGraphs3D::SelectionFlag::Row0x02Selection highlights a single row.
QtGraphs3D::SelectionFlag::ItemAndRowItem | RowCombination flag for highlighting both item and row with different colors.
QtGraphs3D::SelectionFlag::Column0x04Selection highlights a single column.
QtGraphs3D::SelectionFlag::ItemAndColumnItem | ColumnCombination flag for highlighting both item and column with different colors.
QtGraphs3D::SelectionFlag::RowAndColumnRow | ColumnCombination flag for highlighting both row and column.
QtGraphs3D::SelectionFlag::ItemRowAndColumnItem | Row | ColumnCombination flag for highlighting item, row, and column.
QtGraphs3D::SelectionFlag::Slice0x08Setting this mode flag indicates that the graph should take care of the slice view handling automatically. If you wish to control the slice view yourself via Q3DScene, do not set this flag. When setting this mode flag, either Row or Column must also be set, but not both. Slicing is supported by Q3DBarsWidgetItem and Q3DSurfaceWidgetItem only. When this flag is set, slice mode is entered in the following situations:
  • When selection is changed explicitly via series API to a visible item
  • When selection is changed by clicking on the graph
  • When the selection mode changes and the selected item is visible
QtGraphs3D::SelectionFlag::MultiSeries0x10Setting this mode means that items for all series at same position are highlighted, instead of just the selected item. The actual selection in the other series doesn't change. When setting this mode flag, one or more of the basic selection flags (Item, Row, or Column) must also be set. Multi-series selection is not supported for Q3DScatterWidgetItem.

The SelectionFlags type is a typedef for QFlags<SelectionFlag>. It stores an OR combination of SelectionFlag values.

enum class QtGraphs3D::ShadowQuality

Quality of shadows.

ConstantValueDescription
QtGraphs3D::ShadowQuality::None0Shadows are disabled.
QtGraphs3D::ShadowQuality::Low1Shadows are rendered in low quality.
QtGraphs3D::ShadowQuality::Medium2Shadows are rendered in medium quality.
QtGraphs3D::ShadowQuality::High3Shadows are rendered in high quality.
QtGraphs3D::ShadowQuality::SoftLow4Shadows are rendered in low quality with softened edges.
QtGraphs3D::ShadowQuality::SoftMedium5Shadows are rendered in medium quality with softened edges.
QtGraphs3D::ShadowQuality::SoftHigh6Shadows are rendered in high quality with softened edges.

Function Documentation

QSurfaceFormat 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));