QAbstract3DGraph Class

The QAbstract3DGraph class provides a window and render loop for graphs. 更多...

头: #include <QAbstract3DGraph>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
继承: QQuickWidget
继承者:

Q3DBars , Q3DScatter ,和 Q3DSurface

状态: 技术预览

公共类型

enum class CameraPreset { NoPreset, FrontLow, Front, FrontHigh, LeftLow, …, DirectlyBelow }
enum class ElementType { None, Series, AxisXLabel, AxisYLabel, AxisZLabel, CustomItem }
enum class OptimizationHint { Default, Legacy }
enum SelectionFlag { SelectionNone, SelectionItem, SelectionRow, SelectionItemAndRow, SelectionColumn, …, SelectionMultiSeries }
flags SelectionFlags
enum class ShadowQuality { None, Low, Medium, High, SoftLow, …, SoftHigh }

特性

公共函数

virtual ~QAbstract3DGraph () override
QAbstract3DInputHandler * activeInputHandler () const
Q3DTheme * activeTheme () const
int addCustomItem (QCustom3DItem * item )
void addInputHandler (QAbstract3DInputHandler * inputHandler )
void addTheme (Q3DTheme * theme )
qreal aspectRatio () const
QAbstract3DGraph::CameraPreset cameraPreset () const
QVector3D cameraTargetPosition ()
float cameraXRotation ()
float cameraYRotation ()
float cameraZoomLevel ()
void clearSelection ()
int currentFps () const
QList<QCustom3DItem *> customItems () const
bool hasSeries (QAbstract3DSeries * series ) const
qreal horizontalAspectRatio () const
QList<QAbstract3DInputHandler *> inputHandlers () const
bool isOrthoProjection () const
bool isPolar () const
QLocale locale () const
qreal margin () const
float maxCameraZoomLevel ()
bool measureFps () const
float minCameraZoomLevel ()
int msaaSamples () const
QAbstract3DGraph::OptimizationHint optimizationHint () const
QVector3D queriedGraphPosition () const
float radialLabelOffset () const
void releaseCustomItem (QCustom3DItem * item )
void releaseInputHandler (QAbstract3DInputHandler * inputHandler )
void releaseTheme (Q3DTheme * theme )
void removeCustomItem (QCustom3DItem * item )
void removeCustomItemAt (const QVector3D & position )
void removeCustomItems ()
QSharedPointer<QQuickItemGrabResult> renderToImage (const QSize & imageSize = QSize())
Q3DScene * scene () const
QAbstract3DAxis * selectedAxis () const
QCustom3DItem * selectedCustomItem () const
int selectedCustomItemIndex () const
QAbstract3DGraph::ElementType selectedElement () const
int selectedLabelIndex () const
QAbstract3DGraph::SelectionFlags selectionMode () const
void setActiveInputHandler (QAbstract3DInputHandler * inputHandler )
void setActiveTheme (Q3DTheme * activeTheme )
void setAspectRatio (qreal ratio )
void setCameraPosition (float horizontal , float vertical , float zoom = 100.0f)
void setCameraPreset (QAbstract3DGraph::CameraPreset preset )
void setCameraTargetPosition (const QVector3D & target )
void setCameraXRotation (float rotation )
void setCameraYRotation (float rotation )
void setCameraZoomLevel (float level )
void setHorizontalAspectRatio (qreal ratio )
void setLocale (const QLocale & locale )
void setMargin (qreal margin )
void setMaxCameraZoomLevel (float level )
void setMeasureFps (bool enable )
void setMinCameraZoomLevel (float level )
void setMsaaSamples (int samples )
void setOptimizationHint (QAbstract3DGraph::OptimizationHint hint )
void setOrthoProjection (bool enable )
void setPolar (bool enable )
void setRadialLabelOffset (float offset )
void setSelectionMode (const QAbstract3DGraph::SelectionFlags & selectionMode )
void setShadowQuality (const QAbstract3DGraph::ShadowQuality & shadowQuality )
void setWrapCameraXRotation (bool wrap )
void setWrapCameraYRotation (bool wrap )
QAbstract3DGraph::ShadowQuality shadowQuality () const
QList<Q3DTheme *> themes () const
bool wrapCameraXRotation ()
bool wrapCameraYRotation ()

信号

void activeInputHandlerChanged (QAbstract3DInputHandler * inputHandler )
void activeThemeChanged (Q3DTheme * activeTheme )
void aspectRatioChanged (qreal ratio )
void cameraPresetChanged (QAbstract3DGraph::CameraPreset preset )
void cameraTargetPositionChanged (const QVector3D & target )
void cameraXRotationChanged (float rotation )
void cameraYRotationChanged (float rotation )
void cameraZoomLevelChanged (float zoomLevel )
void currentFpsChanged (int fps )
void horizontalAspectRatioChanged (qreal ratio )
void localeChanged (const QLocale & locale )
void marginChanged (qreal margin )
void maxCameraZoomLevelChanged (float zoomLevel )
void measureFpsChanged (bool enabled )
void minCameraZoomLevelChanged (float zoomLevel )
void msaaSamplesChanged (int samples )
void optimizationHintChanged (QAbstract3DGraph::OptimizationHint hint )
void orthoProjectionChanged (bool enabled )
void polarChanged (bool enabled )
void queriedGraphPositionChanged (const QVector3D & data )
void radialLabelOffsetChanged (float offset )
void selectedElementChanged (QAbstract3DGraph::ElementType type )
void selectionModeChanged (const QAbstract3DGraph::SelectionFlags selectionMode )
void shadowQualityChanged (QAbstract3DGraph::ShadowQuality quality )
void wrapCameraXRotationChanged (bool wrap )
void wrapCameraYRotationChanged (bool wrap )
QSurfaceFormat qDefaultSurfaceFormat (bool antialias )

详细描述

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.

Anti-aliasing is turned on by default on C++, except in OpenGL ES2 environments, where anti-aliasing is not supported by Qt Graphs. To specify non-default anti-aliasing for a graph, give a custom surface format as a constructor parameter. You can use the convenience function qDefaultSurfaceFormat() to create the surface format object.

注意: QAbstract3DGraph sets window flag Qt::FramelessWindowHint on by default. If you want to display graph windows as standalone windows with regular window frame, clear this flag after constructing the graph. For example:

Q3DBars *graphWindow = new Q3DBars;
graphWindow->setFlags(graphWindow->flags() ^ Qt::FramelessWindowHint);
					

另请参阅 Q3DBars , Q3DScatter , Q3DSurface ,和 Qt Graphs C++ Classes for 3D .

成员类型文档编制

enum class QAbstract3DGraph:: CameraPreset

用于摄像头的预定义位置。

常量 描述
QAbstract3DGraph::CameraPreset::NoPreset 0 Used to indicate a preset has not been set, or the scene has been rotated freely.
QAbstract3DGraph::CameraPreset::FrontLow 1
QAbstract3DGraph::CameraPreset::Front 2
QAbstract3DGraph::CameraPreset::FrontHigh 3
QAbstract3DGraph::CameraPreset::LeftLow 4
QAbstract3DGraph::CameraPreset::Left 5
QAbstract3DGraph::CameraPreset::LeftHigh 6
QAbstract3DGraph::CameraPreset::RightLow 7
QAbstract3DGraph::CameraPreset::Right 8
QAbstract3DGraph::CameraPreset::RightHigh 9
QAbstract3DGraph::CameraPreset::BehindLow 10
QAbstract3DGraph::CameraPreset::Behind 11
QAbstract3DGraph::CameraPreset::BehindHigh 12
QAbstract3DGraph::CameraPreset::IsometricLeft 13
QAbstract3DGraph::CameraPreset::IsometricLeftHigh 14
QAbstract3DGraph::CameraPreset::IsometricRight 15
QAbstract3DGraph::CameraPreset::IsometricRightHigh 16
QAbstract3DGraph::CameraPreset::DirectlyAbove 17
QAbstract3DGraph::CameraPreset::DirectlyAboveCW45 18
QAbstract3DGraph::CameraPreset::DirectlyAboveCCW45 19
QAbstract3DGraph::CameraPreset::FrontBelow 20 Q3DBars from FrontBelow onward these only work for graphs including negative values. They act as Preset...Low for positive-only values.
QAbstract3DGraph::CameraPreset::LeftBelow 21
QAbstract3DGraph::CameraPreset::RightBelow 22
QAbstract3DGraph::CameraPreset::BehindBelow 23
QAbstract3DGraph::CameraPreset::DirectlyBelow 24 Acts as FrontLow for positive-only bars.

enum class QAbstract3DGraph:: ElementType

Type of an element in the graph.

常量 描述
QAbstract3DGraph::ElementType::None 0 No defined element.
QAbstract3DGraph::ElementType::Series 1 An item in a series.
QAbstract3DGraph::ElementType::AxisXLabel 2 The x-axis label.
QAbstract3DGraph::ElementType::AxisYLabel 3 The y-axis label.
QAbstract3DGraph::ElementType::AxisZLabel 4 The z-axis label.
QAbstract3DGraph::ElementType::CustomItem 5 A custom item.

enum class QAbstract3DGraph:: OptimizationHint

The optimization hint for rendering.

常量 描述
QAbstract3DGraph::OptimizationHint::Default 0 Provides the full feature set with instancing at a good performance.
QAbstract3DGraph::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 QAbstract3DGraph:: SelectionFlag
flags QAbstract3DGraph:: SelectionFlags

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

常量 描述
QAbstract3DGraph::SelectionNone 0 Selection mode disabled.
QAbstract3DGraph::SelectionItem 1 Selection highlights a single item.
QAbstract3DGraph::SelectionRow 2 Selection highlights a single row.
QAbstract3DGraph::SelectionItemAndRow SelectionItem | SelectionRow Combination flag for highlighting both item and row with different colors.
QAbstract3DGraph::SelectionColumn 4 Selection highlights a single column.
QAbstract3DGraph::SelectionItemAndColumn SelectionItem | SelectionColumn Combination flag for highlighting both item and column with different colors.
QAbstract3DGraph::SelectionRowAndColumn SelectionRow | SelectionColumn Combination flag for highlighting both row and column.
QAbstract3DGraph::SelectionItemRowAndColumn SelectionItem | SelectionRow | SelectionColumn Combination flag for highlighting item, row, and column.
QAbstract3DGraph::SelectionSlice 8 Setting 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 SelectionRow or SelectionColumn must also be set, but not both. Slicing is supported by Q3DBars and Q3DSurface 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
QAbstract3DGraph::SelectionMultiSeries 16 Setting 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 ( SelectionItem , SelectionRow ,或 SelectionColumn ) must also be set. Multi-series selection is not supported for Q3DScatter .

SelectionFlags 类型是 typedef 对于 QFlags <SelectionFlag>。它存储 SelectionFlag 值的 OR 组合。

enum class QAbstract3DGraph:: ShadowQuality

Quality of shadows.

常量 描述
QAbstract3DGraph::ShadowQuality::None 0 Shadows are disabled.
QAbstract3DGraph::ShadowQuality::Low 1 Shadows are rendered in low quality.
QAbstract3DGraph::ShadowQuality::Medium 2 Shadows are rendered in medium quality.
QAbstract3DGraph::ShadowQuality::High 3 Shadows are rendered in high quality.
QAbstract3DGraph::ShadowQuality::SoftLow 4 Shadows are rendered in low quality with softened edges.
QAbstract3DGraph::ShadowQuality::SoftMedium 5 Shadows are rendered in medium quality with softened edges.
QAbstract3DGraph::ShadowQuality::SoftHigh 6 Shadows are rendered in high quality with softened edges.

特性文档编制

activeInputHandler : QAbstract3DInputHandler *

This property holds the active input handler used in the graph.

访问函数:

QAbstract3DInputHandler * activeInputHandler () const
void setActiveInputHandler (QAbstract3DInputHandler * inputHandler )

通知程序信号:

void activeInputHandlerChanged (QAbstract3DInputHandler * inputHandler )

activeTheme : Q3DTheme *

This property holds the active theme of the graph.

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

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.

访问函数:

Q3DTheme * activeTheme () const
void setActiveTheme (Q3DTheme * activeTheme )

通知程序信号:

void activeThemeChanged (Q3DTheme * activeTheme )

aspectRatio : qreal

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

默认为 2.0 .

注意: Has no effect on Q3DBars .

访问函数:

qreal aspectRatio () const
void setAspectRatio (qreal ratio )

通知程序信号:

void aspectRatioChanged (qreal ratio )

另请参阅 horizontalAspectRatio .

cameraTargetPosition : QVector3D

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

默认为 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.

注意: For bar graphs, the Y-coordinate is ignored and camera always targets a point on the horizontal background.

访问函数:

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

通知程序信号:

void cameraTargetPositionChanged (const QVector3D & target )

cameraXRotation : float

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

访问函数:

float cameraXRotation ()
void setCameraXRotation (float rotation )

通知程序信号:

void cameraXRotationChanged (float rotation )

cameraYRotation : float

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

访问函数:

float cameraYRotation ()
void setCameraYRotation (float rotation )

通知程序信号:

void cameraYRotationChanged (float rotation )

cameraZoomLevel : float

此特性保持摄像头的缩放级别按百分比。

默认值 100.0f 意味着摄像头没有设置放大 (或缩小)。值被限制通过 minCameraZoomLevel and maxCameraZoomLevel 特性。

访问函数:

float cameraZoomLevel ()
void setCameraZoomLevel (float level )

通知程序信号:

void cameraZoomLevelChanged (float zoomLevel )

另请参阅 minCameraZoomLevel and maxCameraZoomLevel .

[read-only] currentFps : const 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.

访问函数:

int currentFps () const

通知程序信号:

void currentFpsChanged (int fps )

另请参阅 measureFps .

horizontalAspectRatio : qreal

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

0.0 indicates automatic scaling according to axis ranges. Defaults to 0.0 .

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

访问函数:

qreal horizontalAspectRatio () const
void setHorizontalAspectRatio (qreal ratio )

通知程序信号:

void horizontalAspectRatioChanged (qreal ratio )

另请参阅 aspectRatio , polar , Q3DBars::barThickness ,和 Q3DBars::barSpacing .

locale : QLocale

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

Defaults to the "C" locale.

访问函数:

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

通知程序信号:

void localeChanged (const QLocale & locale )

另请参阅 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 beed changed from the default values. Defaults to -1.0 .

注意: 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.

注意: 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.

访问函数:

qreal margin () const
void setMargin (qreal margin )

通知程序信号:

void marginChanged (qreal margin )

maxCameraZoomLevel : float

此特性保持允许的最大摄像头缩放级别。

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 .

访问函数:

float maxCameraZoomLevel ()
void setMaxCameraZoomLevel (float level )

通知程序信号:

void maxCameraZoomLevelChanged (float zoomLevel )

另请参阅 cameraZoomLevel and minCameraZoomLevel .

measureFps : bool

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

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

访问函数:

bool measureFps () const
void setMeasureFps (bool enable )

通知程序信号:

void measureFpsChanged (bool enabled )

另请参阅 currentFps .

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 。默认为 10.0f .

访问函数:

float minCameraZoomLevel ()
void setMinCameraZoomLevel (float level )

通知程序信号:

void minCameraZoomLevelChanged (float zoomLevel )

另请参阅 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.

访问函数:

int msaaSamples () const
void setMsaaSamples (int samples )

通知程序信号:

void msaaSamplesChanged (int samples )

optimizationHint : QAbstract3DGraph::OptimizationHint

This property holds whether the default, static, 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 默认 .

注意: 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.

访问函数:

QAbstract3DGraph::OptimizationHint optimizationHint () const
void setOptimizationHint (QAbstract3DGraph::OptimizationHint hint )

通知程序信号:

void optimizationHintChanged (QAbstract3DGraph::OptimizationHint hint )

另请参阅 QAbstract3DSeries::mesh .

orthoProjection : bool

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

默认为 false .

注意: Shadows will be disabled when set to true .

访问函数:

bool isOrthoProjection () const
void setOrthoProjection (bool enable )

通知程序信号:

void orthoProjectionChanged (bool enabled )

另请参阅 QAbstract3DAxis::labelAutoRotation .

polar : bool

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

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

默认为 false .

访问函数:

bool isPolar () const
void setPolar (bool enable )

通知程序信号:

void polarChanged (bool enabled )

另请参阅 orthoProjection and radialLabelOffset .

[read-only] queriedGraphPosition : const 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.

注意: 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.

访问函数:

QVector3D queriedGraphPosition () const

通知程序信号:

void queriedGraphPositionChanged (const QVector3D & data )

另请参阅 Q3DScene::graphPositionQuery .

radialLabelOffset : float

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

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 .

访问函数:

float radialLabelOffset () const
void setRadialLabelOffset (float offset )

通知程序信号:

void radialLabelOffsetChanged (float offset )

另请参阅 polar .

[read-only] scene : Q3DScene * const

此特性保持 Q3DScene pointer that can be used to manipulate the scene and access the scene elements.

This property is read-only.

访问函数:

Q3DScene * scene () const

[read-only] selectedElement : const QAbstract3DGraph::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 信号发射。

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

访问函数:

QAbstract3DGraph::ElementType selectedElement () const

通知程序信号:

void selectedElementChanged (QAbstract3DGraph::ElementType type )

另请参阅 selectedLabelIndex (), selectedAxis (), selectedCustomItemIndex (), selectedCustomItem (), Q3DBars::selectedSeries (), Q3DScatter::selectedSeries (), Q3DSurface::selectedSeries (),和 Q3DScene::setSelectionQueryPosition ().

selectionMode : QAbstract3DGraph::SelectionFlags

Item selection mode.

A combination of SelectionFlags 。默认情况下, SelectionItem . Different graph types support different selection modes.

访问函数:

QAbstract3DGraph::SelectionFlags selectionMode () const
void setSelectionMode (const QAbstract3DGraph::SelectionFlags & selectionMode )

通知程序信号:

void selectionModeChanged (const QAbstract3DGraph::SelectionFlags selectionMode )

另请参阅 SelectionFlags .

shadowQuality : QAbstract3DGraph::ShadowQuality

This property holds the quality of the shadow.

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

注意: 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.

访问函数:

QAbstract3DGraph::ShadowQuality shadowQuality () const
void setShadowQuality (const QAbstract3DGraph::ShadowQuality & shadowQuality )

通知程序信号:

void shadowQualityChanged (QAbstract3DGraph::ShadowQuality quality )

另请参阅 ShadowQuality .

wrapCameraXRotation : bool

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

若设为 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 在默认情况下。

访问函数:

bool wrapCameraXRotation ()
void setWrapCameraXRotation (bool wrap )

通知程序信号:

void wrapCameraXRotationChanged (bool wrap )

wrapCameraYRotation : bool

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

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 在默认情况下。

访问函数:

bool wrapCameraYRotation ()
void setWrapCameraYRotation (bool wrap )

通知程序信号:

void wrapCameraYRotationChanged (bool wrap )

成员函数文档编制

[override virtual noexcept] QAbstract3DGraph:: ~QAbstract3DGraph ()

销毁 QAbstract3DGraph .

int QAbstract3DGraph:: addCustomItem ( QCustom3DItem * item )

添加 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.

另请参阅 removeCustomItems (), removeCustomItem (), removeCustomItemAt (),和 customItems ().

void QAbstract3DGraph:: addInputHandler ( QAbstract3DInputHandler * inputHandler )

添加给定 inputHandler to the graph. The input handlers added via addInputHandler are not taken in to use directly. Only the ownership of the inputHandler is given to the graph. The inputHandler must not be null or already added to another graph.

另请参阅 releaseInputHandler () 和 setActiveInputHandler ().

void QAbstract3DGraph:: addTheme ( Q3DTheme * theme )

添加给定 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.

另请参阅 releaseTheme () 和 setActiveTheme ().

void QAbstract3DGraph:: clearSelection ()

Clears selection from all attached series.

QList < QCustom3DItem *> QAbstract3DGraph:: customItems () const

Returns the list of all added custom items.

另请参阅 addCustomItem ().

bool QAbstract3DGraph:: hasSeries ( QAbstract3DSeries * series ) const

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

QList < QAbstract3DInputHandler *> QAbstract3DGraph:: inputHandlers () const

Returns the list of all added input handlers.

另请参阅 addInputHandler ().

void QAbstract3DGraph:: releaseCustomItem ( QCustom3DItem * item )

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

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

另请参阅 QCustom3DItem::setTextureImage () 和 QCustom3DItem::setTextureFile ().

void QAbstract3DGraph:: releaseInputHandler ( QAbstract3DInputHandler * inputHandler )

Releases the ownership of the inputHandler back to the caller, if it was added to this graph. If the released inputHandler is in use there will be no input handler active after this call.

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

另请参阅 addInputHandler () 和 setActiveInputHandler ().

void QAbstract3DGraph:: releaseTheme ( Q3DTheme * 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.

另请参阅 addTheme () 和 setActiveTheme ().

void QAbstract3DGraph:: removeCustomItem ( QCustom3DItem * item )

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

void QAbstract3DGraph:: removeCustomItemAt (const QVector3D & position )

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

void QAbstract3DGraph:: removeCustomItems ()

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

QSharedPointer < QQuickItemGrabResult > QAbstract3DGraph:: renderToImage (const QSize & imageSize = QSize())

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

注意: OpenGL ES2 does not support anitialiasing.

另请参阅 QQuickItem::grabToImage .

QAbstract3DAxis *QAbstract3DGraph:: 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 信号。

Returns the pointer to the selected axis, or null.

另请参阅 selectedElement .

QCustom3DItem *QAbstract3DGraph:: selectedCustomItem () const

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

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

另请参阅 selectedElement .

int QAbstract3DGraph:: selectedCustomItemIndex () const

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

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

另请参阅 selectedElement .

int QAbstract3DGraph:: 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 信号。

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

另请参阅 selectedElement .

void QAbstract3DGraph:: setActiveInputHandler ( QAbstract3DInputHandler * inputHandler )

设置 inputHandler as the active input handler used in the graph. Implicitly calls addInputHandler () to transfer ownership of inputHandler to this graph.

inputHandler is null, no input handler will be active after this call.

注意: setter 函数对于特性 activeInputHandler .

另请参阅 activeInputHandler (), addInputHandler (),和 releaseInputHandler ().

void QAbstract3DGraph:: 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 特性。

QList < Q3DTheme *> QAbstract3DGraph:: themes () const

Returns the list of all added themes.

另请参阅 addTheme ().

相关非成员

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