Q3DGraphsWidgetItem Class
Q3DGraphsWidgetItem 类为图形提供窗口和渲染循环。更多
Header: | #include <Q3DGraphsWidgetItem> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS GraphsWidgets) target_link_libraries(mytarget PRIVATE Qt6::GraphsWidgets) |
qmake: | QT += graphswidgets |
继承: | QObject |
继承于 | Q3DBarsWidgetItem,Q3DScatterWidgetItem, 以及Q3DSurfaceWidgetItem |
- 所有成员的列表,包括继承成员
- Q3DGraphsWidgetItem 属于Qt Graphs C++ 小工具类。
属性
公共功能
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 |
void | doPicking(QPoint point) |
void | doRayPicking(QVector3D origin, QVector3D direction) |
QtGraphs3D::GridLineType | gridLineType() const |
bool | hasSeries(QAbstract3DSeries *series) const |
qreal | horizontalAspectRatio() const |
bool | isOrthoProjection() 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 |
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 | 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) |
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) |
QtGraphs3D::ShadowQuality | shadowQuality() const |
float | shadowStrength() const |
QList<QGraphsTheme *> | themes() const |
QtGraphs3D::TransparencyTechnique | transparencyTechnique() const |
QQuickWidget * | widget() const |
bool | wrapCameraXRotation() const |
bool | wrapCameraYRotation() const |
信号
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 | 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 | 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) |
详细说明
该类是QWindow 的子类,为继承该类的图形提供渲染循环。
您无需直接使用该类,而应使用其子类。
QSurfaceFormat
中默认关闭多重采样。要启用多重采样,可将自定义曲面格式设为默认曲面格式。要获取自定义曲面格式,请使用QQuick3D::idealSurfaceFormat().
另请参阅 Q3DBarsWidgetItem,Q3DScatterWidgetItem,Q3DSurfaceWidgetItem, 和Qt Graphs C++ Classes for 3D.
属性文档
activeTheme : QGraphsTheme*
此属性用于保存图表的活动主题。
将activeTheme 设置为图表的活动主题。隐式调用addTheme() 将主题的所有权转移到此图形。
如果activeTheme 为空,则会创建一个临时默认主题。如果以后显式设置了任何主题,该临时主题将被销毁。即使在设置主题后,也可以修改主题的属性,而且修改会立即生效。
访问功能
QGraphsTheme * | activeTheme() const |
void | setActiveTheme(QGraphsTheme *activeTheme) |
通知信号
void | activeThemeChanged(QGraphsTheme *activeTheme) |
ambientLightStrength : float
该属性用于保存整个图形的环境光强度。
无论光线位置如何,该值都将决定整个图表中颜色显示的均匀度和亮度。
该值必须介于0.0f
和1.0f
之间。
访问功能:
float | ambientLightStrength() const |
void | setAmbientLightStrength(float newAmbientLightStrength) |
通知信号:
void | ambientLightStrengthChanged() |
aspectRatio : qreal
该属性用于保存水平面最长轴与 Y 轴之间的图形缩放比例。
默认为2.0
。
注: 对Q3DBarsWidgetItem 没有影响。
访问功能:
qreal | aspectRatio() const |
void | setAspectRatio(qreal ratio) |
Notifier 信号:
void | aspectRatioChanged(qreal ratio) |
另请参阅 horizontalAspectRatio 。
cameraTargetPosition : QVector3D
此属性将摄像机目标位置保存为三维空间中的矢量或顶点。
默认值为QVector3D(0.0, 0.0, 0.0)
。
有效坐标值介于-1.0...1.0
之间,其中边缘值表示相应坐标轴范围的边缘。任何超出此范围的值都会被箝位到边缘。
访问功能:
QVector3D | cameraTargetPosition() const |
void | setCameraTargetPosition(QVector3D target) |
通知信号:
void | cameraTargetPositionChanged(QVector3D target) |
cameraXRotation : float
该属性用于保存摄像机绕目标点的 X 旋转角度(单位:度)。
访问功能
float | cameraXRotation() const |
void | setCameraXRotation(float rotation) |
通知信号:
void | cameraXRotationChanged(float rotation) |
cameraYRotation : float
该属性保存摄像机绕目标点的 Y 轴旋转角度(度)。
访问功能
float | cameraYRotation() const |
void | setCameraYRotation(float rotation) |
通知信号:
void | cameraYRotationChanged(float rotation) |
cameraZoomLevel : float
此属性以百分比表示摄像机的缩放级别。
默认值为100.0f
,表示摄像机没有设置放大或缩小。该值受minCameraZoomLevel 和maxCameraZoomLevel 属性的限制。
访问功能:
float | cameraZoomLevel() const |
void | setCameraZoomLevel(float level) |
通知信号:
void | cameraZoomLevelChanged(float zoomLevel) |
另请参阅 minCameraZoomLevel 和maxCameraZoomLevel 。
[read-only]
currentFps : const int
该属性保存最后一秒的渲染结果。
启用 FPS 测量后,结果将存储在此只读属性中。测量激活后,该值至少需要一秒钟才能更新。
访问功能:
int | currentFps() const |
Notifier 信号:
void | currentFpsChanged(int fps) |
另请参见 measureFps 。
gridLineType : QtGraphs3D::GridLineType
此属性表示网格线类型是QtGraphs3D::GridLineType::Shader 还是QtGraphs3D::GridLineType::Geometry 。
该值会影响所有网格线。
访问功能:
QtGraphs3D::GridLineType | gridLineType() const |
void | setGridLineType(const QtGraphs3D::GridLineType &gridLineType) |
通知信号:
void | gridLineTypeChanged() |
另请参阅 QtGraphs3D::GridLineType 。
horizontalAspectRatio : qreal
该属性表示 x 轴和 z 轴之间的图形缩放比例。
0.0
表示根据坐标轴范围自动缩放。默认值为0.0
。
对Q3DBarsWidgetItem 没有影响,它通过barThickness 和barSpacing 属性处理水平面的缩放。极坐标图形也会忽略此属性。
访问功能:
qreal | horizontalAspectRatio() const |
void | setHorizontalAspectRatio(qreal ratio) |
Notifier 信号:
void | horizontalAspectRatioChanged(qreal ratio) |
另请参见 aspectRatio,polar,Q3DBarsWidgetItem::barThickness, 和Q3DBarsWidgetItem::barSpacing 。
labelMargin : float
该属性指定轴标签放置的边距。
负值用于将标签置于绘图区域内,正值用于将标签置于绘图区域外。当值为负数时,标签自动旋转功能将被禁用。默认值为0.1
访问功能:
float | labelMargin() const |
void | setLabelMargin(float margin) |
Notifier 信号:
void | labelMarginChanged(float margin) |
另请参阅 QAbstract3DAxis::labelAutoAngle 。
lightColor : QColor
该属性用于保存环境光和镜面反射光的颜色。
该值会影响Q3DScene 中指定的光线。
访问功能:
QColor | lightColor() const |
void | setLightColor(QColor newLightColor) |
Notifier 信号:
void | lightColorChanged() |
lightStrength : float
该属性用于保存整个图形的镜面反射光强度。
该值必须介于0.0f
和10.0f
之间。
该值会影响Q3DScene 中指定的光线。
访问功能:
float | lightStrength() const |
void | setLightStrength(float newLightStrength) |
通知信号:
void | lightStrengthChanged() |
locale : QLocale
该属性包含用于格式化各种数字标签的本地语言。
默认为"C"
locale。
访问功能:
QLocale | locale() const |
void | setLocale(const QLocale &locale) |
Notifier 信号:
void | localeChanged(const QLocale &locale) |
另请参阅 QValue3DAxis::labelFormat 。
margin : qreal
该属性用于保存可绘图区域边缘与图形背景边缘之间留出的空间的绝对值。
如果边距值为负数,边距将自动确定,并根据系列中项目的大小和图形类型而变化。如果图形纵横比未从默认值中更改,则该值将被解释为 Y 轴范围的一部分。默认值为-1.0
。
注意: 如果为散点图设置的边距小于自动确定的边距,可能会导致图形边缘的散点项与图 形背景重叠。
注: 在散点图和曲面图中,如果边距小于坐标轴标签尺寸,则会调整坐标轴边缘标签的位 置,以避免与相邻坐标轴的边缘标签重叠。
访问功能
qreal | margin() const |
void | setMargin(qreal margin) |
通知信号
void | marginChanged(qreal margin) |
maxCameraXRotation : float
该属性用于保存摄像机围绕目标点的最大 X 旋转角度(单位:度)。默认值为180.0
访问功能:
float | maxCameraXRotation() const |
void | setMaxCameraXRotation(float rotation) |
通知信号:
void | maxCameraXRotationChanged(float rotation) |
maxCameraYRotation : float
该属性用于保存摄像机围绕目标点的最大 Y 向旋转角度(单位:度)。默认值为90.0
访问功能:
float | maxCameraYRotation() const |
void | setMaxCameraYRotation(float rotation) |
通知信号:
void | maxCameraYRotationChanged(float rotation) |
maxCameraZoomLevel : float
此属性保存允许的最大摄像机缩放级别。
如果最大缩放级别设置为低于现有最小缩放级别的新值,则最小缩放级别也会调整为新的最大值。如果当前的cameraZoomLevel 超出了新的范围,也会进行调整。默认值为500.0f
。
访问功能:
float | maxCameraZoomLevel() const |
void | setMaxCameraZoomLevel(float level) |
通知信号:
void | maxCameraZoomLevelChanged(float zoomLevel) |
另请参阅 cameraZoomLevel 和minCameraZoomLevel 。
measureFps : bool
该属性表示渲染是否连续进行,而不是按需渲染。
如果true
,渲染将持续进行,并且currentFps 属性的值将被更新。默认为false
。
访问功能:
bool | measureFps() const |
void | setMeasureFps(bool enable) |
Notifier 信号:
void | measureFpsChanged(bool enabled) |
另请参阅 currentFps 。
minCameraXRotation : float
该属性用于保存摄像机围绕目标点的最小 X 旋转角度(单位:度)。默认值为-180.0
访问功能:
float | minCameraXRotation() const |
void | setMinCameraXRotation(float rotation) |
通知信号:
void | minCameraXRotationChanged(float rotation) |
minCameraYRotation : float
该属性用于保存摄像机围绕目标点的最小 Y 旋转角度(单位:度)。默认值为0.0
访问功能:
float | minCameraYRotation() const |
void | setMinCameraYRotation(float rotation) |
通知信号:
void | minCameraYRotationChanged(float rotation) |
minCameraZoomLevel : float
此属性用于保存允许的最小摄像机缩放级别。
如果将最小级别设置为高于现有最大级别的新值,则最大级别也会调整为新的最小值。如果当前的 zoomLevel 超出了新的范围,也会进行调整。minCameraZoomLevel 不能设置为低于1.0f
。默认值为10.0f
。
访问功能:
float | minCameraZoomLevel() const |
void | setMinCameraZoomLevel(float level) |
通知信号:
void | minCameraZoomLevelChanged(float zoomLevel) |
另请参阅 cameraZoomLevel 和maxCameraZoomLevel 。
msaaSamples : int
该属性用于保存 MSAA 中已使用的样本数。
将已使用的 MSAA 采样个数设置为samples 。采样个数可以是 0、2、4 或 8。
访问功能:
int | msaaSamples() const |
void | setMsaaSamples(int samples) |
通知信号:
void | msaaSamplesChanged(int samples) |
optimizationHint : QtGraphs3D::OptimizationHint
指定渲染优化是使用默认模式还是传统模式。
默认模式使用实例渲染,可在大多数系统上以最佳性能提供完整的功能集。静态模式可优化图形渲染,是大型非变化数据集的理想选择。但在动态数据变化和项目旋转的情况下,该模式的运行速度较慢。选择功能未作优化,因此不建议对海量数据集使用静态模式。静态优化仅适用于散点图。传统模式会单独渲染图形中的所有项目,而不会实例化。只有在默认模式不起作用(即目标系统不支持实例化)的情况下才可使用。默认值为QtGraphs3D::OptimizationHint::Default 。
注意: 在某些环境下,使用静态优化的大型图形可能无法渲染,因为所有项目都是通过单次绘制调用渲染的,而不同的图形驱动程序支持不同的每次调用最大顶点数。这个问题主要出现在 32 位和 OpenGL ES2 平台上。要解决这个问题,可以选择顶点数较少的项目网格或使用点网格。
访问功能:
QtGraphs3D::OptimizationHint | optimizationHint() const |
void | setOptimizationHint(QtGraphs3D::OptimizationHint hint) |
通知信号:
void | optimizationHintChanged(QtGraphs3D::OptimizationHint hint) |
另请参见 QAbstract3DSeries::mesh 。
orthoProjection : bool
此属性表示是否使用正投影法显示图形。
默认为false
。
注: 设置为true
时将禁用阴影。
访问功能:
bool | isOrthoProjection() const |
void | setOrthoProjection(bool enable) |
Notifier 信号:
void | orthoProjectionChanged(bool enabled) |
另请参阅 QAbstract3DAxis::labelAutoAngle 。
polar : bool
水平轴是否变为极轴取决于此属性。
如果true
,则 x 轴变为角度轴,z 轴变为径向轴。极轴模式不适用于条形图。
默认为false
。
访问功能:
bool | isPolar() const |
void | setPolar(bool enable) |
Notifier 信号:
void | polarChanged(bool enabled) |
另请参阅 orthoProjection 和radialLabelOffset 。
[read-only]
queriedGraphPosition : const QVector3D
该属性保存沿各坐标轴最新查询的图形位置值。
此只读属性包含来自Q3DScene::graphPositionQuery 的结果。这些值已归一化为[-1, 1]
的范围。如果查询到的位置超出了图形边界,则该值将不会反映真实位置,而是表示超出[-1, 1]
范围的未定义位置。在进行查询之前,该值都是未定义的。
没有一个正确的三维坐标与特定的屏幕位置相匹配,因此为了保持一致,查询总是针对图形周围的一个不可见框的内侧进行。
注意: 条形图只允许在图形底层查询图形位置,因此条形图的 y 值始终为零,有效查询只能在包含图形底层的屏幕位置进行。
访问功能:
QVector3D | queriedGraphPosition() const |
通知信号:
void | queriedGraphPositionChanged(QVector3D data) |
另请参见 Q3DScene::graphPositionQuery 。
radialLabelOffset : float
该属性用于保存径向极轴标签的归一化水平偏移量。
0.0
表示标签应绘制在 0 角度角轴网格线旁边。1.0
表示标签绘制在图形背景边缘的常规位置。默认值为1.0
。
如果polar 属性值为false
,该属性将被忽略。
访问功能:
float | radialLabelOffset() const |
void | setRadialLabelOffset(float offset) |
Notifier 信号:
void | radialLabelOffsetChanged(float offset) |
另请参阅 polar 。
rotationEnabled : bool
此属性表示此输入处理程序是否允许图形旋转。
默认为true
。
访问函数:
bool | isRotationEnabled() const |
void | setRotationEnabled(bool enable) |
Notifier 信号:
void | rotationEnabledChanged(bool enable) |
[read-only]
scene : Q3DScene* const
该属性包含Q3DScene 指针,可用于操作场景和访问场景元素。
该属性为只读。
访问功能:
Q3DScene * | scene() const |
[read-only]
selectedElement : const QtGraphs3D::ElementType
该属性用于保存图形中选定的元素。
该属性可用于查询所选元素的类型。该类型一直有效,直到在图形中做出新的选择并发出selectedElementChanged
信号。
例如,该信号可用于实现自定义输入处理程序,如Scatter Graph 标签下的图库示例所示。
访问功能:
QtGraphs3D::ElementType | selectedElement() const |
Notifier 信号:
void | selectedElementChanged(QtGraphs3D::ElementType type) |
另请参阅 selectedLabelIndex(),selectedAxis(),selectedCustomItemIndex(),selectedCustomItem(),Q3DBarsWidgetItem::selectedSeries(),Q3DScatterWidgetItem::selectedSeries(),Q3DSurfaceWidgetItem::selectedSeries() 和Q3DScene::setSelectionQueryPosition().
selectionEnabled : bool
此属性表示此输入处理程序是否允许从图形中进行选择。
默认为true
。
访问功能:
bool | isSelectionEnabled() const |
void | setSelectionEnabled(bool enable) |
Notifier 信号:
void | selectionEnabledChanged(bool enable) |
selectionMode : QtGraphs3D::SelectionFlags
项目选择模式。
SelectionFlags 的组合。默认情况下,Item
。不同的图表类型支持不同的选择模式。
访问功能:
QtGraphs3D::SelectionFlags | selectionMode() const |
void | setSelectionMode(const QtGraphs3D::SelectionFlags &selectionMode) |
通知信号:
void | selectionModeChanged(const QtGraphs3D::SelectionFlags selectionMode) |
另请参见 QtGraphs3D::SelectionFlags 。
shadowQuality : QtGraphs3D::ShadowQuality
此属性表示阴影的质量。
它是 ShadowQuality 枚举值之一。默认情况下,Medium
。
注: 如果将阴影质量设置为某一级别失败,则会降低该级别,直到成功设置为止。每次更改都会发出shadowQualityChanged
信号。
访问功能:
QtGraphs3D::ShadowQuality | shadowQuality() const |
void | setShadowQuality(const QtGraphs3D::ShadowQuality &shadowQuality) |
Notifier 信号:
void | shadowQualityChanged(QtGraphs3D::ShadowQuality quality) |
另请参阅 QtGraphs3D::ShadowQuality 。
shadowStrength : float
该属性表示整个图形的阴影强度。
数值越大,阴影越暗。该值必须介于0.0
和100.0
之间。
该值会影响Q3DScene 中指定的光线。
访问功能:
float | shadowStrength() const |
void | setShadowStrength(float newShadowStrength) |
通知信号:
void | shadowStrengthChanged() |
[since 6.9]
transparencyTechnique : QtGraphs3D::TransparencyTechnique
指定要使用的透明度技术。默认值为Default
。渲染透明曲面图时,请使用Approximate
或Accurate
。
常数 | 说明 |
---|---|
Default | 表示不使用与顺序无关的透明技术。提供最佳性能。当图形不包含透明度或条形图或散点图也使用实例化时使用,即optimizationHint 是 {QtGraphs3D::OptimizationHint::Default}。 |
Approximate | 表示图形尝试近似与阶无关的透明度。这种方法比Accurate 更快,而且可以在较旧的硬件上运行,但可能产生不准确的结果。当需要与阶次无关的透明度,但性能代价必须低于使用精确的与阶次无关的透明度时使用。 |
Accurate | 表示使用与阶次无关的精确透明度。在需要完美的透明度渲染时使用。 |
注意: 精确透明尚未实现,将在所需功能添加到QtQuick3D 后启用。
此属性在 Qt 6.9 中引入。
访问函数:
QtGraphs3D::TransparencyTechnique | transparencyTechnique() const |
void | setTransparencyTechnique(QtGraphs3D::TransparencyTechnique technique) |
Notifier 信号:
void | transparencyTechniqueChanged(QtGraphs3D::TransparencyTechnique technique) |
另请参阅 QtGraphs3D::TransparencyTechnique 。
wrapCameraXRotation : bool
此属性用于设置 X 轴旋转的最小和最大限制。
如果设置为true
,摄像机的 X 轴旋转将从最小值包络到最大值,从最大值包络到最小值。如果设置为false
,摄像机的 X 轴旋转将限制在由最小值和最大值决定的扇形范围内。默认设置为true
。
访问功能:
bool | wrapCameraXRotation() const |
void | setWrapCameraXRotation(bool wrap) |
通知信号:
void | wrapCameraXRotationChanged(bool wrap) |
wrapCameraYRotation : bool
此属性用于设置 Y 轴旋转的最小和最大限制。
如果true
,摄像机的 Y 轴旋转将从最小值到最大值以及从最大值到最小值进行包络。如果设置为false
,摄像机的 Y 轴旋转将限制在由最小值和最大值决定的扇形范围内。默认设置为true
。
访问功能:
bool | wrapCameraYRotation() const |
void | setWrapCameraYRotation(bool wrap) |
通知信号:
void | wrapCameraYRotationChanged(bool wrap) |
zoomAtTargetEnabled : bool
此属性表示缩放是否会改变摄像机目标,以便图形的缩放点在缩放后保持在同一位置。
默认为true
。
访问功能:
bool | isZoomAtTargetEnabled() const |
void | setZoomAtTargetEnabled(bool enable) |
通知信号:
void | zoomAtTargetEnabledChanged(bool enable) |
zoomEnabled : bool
此属性表示此输入处理程序是否允许图形缩放。
默认为true
。
访问功能:
bool | isZoomEnabled() const |
void | setZoomEnabled(bool enable) |
Notifier 信号:
void | zoomEnabledChanged(bool enable) |
成员函数 文档
[override virtual noexcept]
Q3DGraphsWidgetItem::~Q3DGraphsWidgetItem()
qsizetype Q3DGraphsWidgetItem::addCustomItem(QCustom3DItem *item)
向图表添加QCustom3DItem item 。图形拥有添加项的所有权。
如果添加操作成功,则返回已添加项的索引;如果试图添加一个空项,则返回-1;如果试图添加一个已添加项,则返回该项的索引。
项目将按照插入的顺序呈现。如果有实心和透明项目,则需要考虑呈现顺序。
另请参见 removeCustomItems()、removeCustomItem()、removeCustomItemAt() 和customItems()。
void Q3DGraphsWidgetItem::addTheme(QGraphsTheme *theme)
将给定的theme 添加到图形中。通过 addTheme 添加的主题不会被直接使用。只会向图表提供主题的所有权。theme 不得为空或已添加到另一个图中。
另请参阅 releaseTheme() 和setActiveTheme()。
void Q3DGraphsWidgetItem::clearSelection()
清除所有附加系列的选择。
QList<QCustom3DItem *> Q3DGraphsWidgetItem::customItems() const
返回所有已添加的自定义项目列表。
另请参阅 addCustomItem()。
void Q3DGraphsWidgetItem::doPicking(QPoint point)
使用point 中的视图坐标对图形元素进行拾取,选择第一个被点击的项目。默认输入处理会在接收到 onTapped 事件时执行此操作。
另请参见 selectedElement 。
void Q3DGraphsWidgetItem::doRayPicking(QVector3D origin, QVector3D direction)
从origin 开始,在direction 中对图形元素进行拾取,选择第一个命中的项目。
另请参见 selectedElement 。
bool Q3DGraphsWidgetItem::hasSeries(QAbstract3DSeries *series) const
返回series 是否已添加到图表中。
void Q3DGraphsWidgetItem::releaseCustomItem(QCustom3DItem *item)
取回item 的所有权,并从图形中删除item 。
注: 如果将同一项目添加回图形,则需要重新设置纹理或纹理文件。
另请参阅 QCustom3DItem::setTextureImage() 和QCustom3DItem::setTextureFile()。
void Q3DGraphsWidgetItem::releaseTheme(QGraphsTheme *theme)
如果theme 已添加到此图,则将其所有权释放给调用者。如果被释放的theme 正在使用中,则会创建一个新的默认主题并将其设置为活动状态。
如果默认主题被释放并在稍后添加回来,则其行为与其他主题相同。
另请参阅 addTheme() 和setActiveTheme()。
void Q3DGraphsWidgetItem::removeCustomItem(QCustom3DItem *item)
删除自定义item 。删除分配给它的资源。
void Q3DGraphsWidgetItem::removeCustomItemAt(QVector3D position)
删除position 上的所有自定义项目。删除分配给它们的资源。
void Q3DGraphsWidgetItem::removeCustomItems()
删除所有自定义项目。删除分配给它们的资源。
QSharedPointer<QQuickItemGrabResult> Q3DGraphsWidgetItem::renderToImage(QSize imageSize = QSize()) const
将当前帧渲染为imageSize 的图像。返回一个指向抓取结果的共享指针,该指针可在渲染完成后用于访问渲染后的图像。图像将使用当前的抗锯齿设置渲染。
另请参阅 QQuickItem::grabToImage().
QAbstract3DAxis *Q3DGraphsWidgetItem::selectedAxis() const
可用于在接收到带有任何标签类型的selectedElementChanged
信号后获取所选轴。选择有效期至下一个selectedElementChanged
信号发出。
返回选中轴的指针或 null。
另请参见 selectedElement 。
QCustom3DItem *Q3DGraphsWidgetItem::selectedCustomItem() const
可用于在接收到selectedElementChanged
信号后获取选定的自定义项目,该信号具有 Q3DGraphsWidgetItem::ElementType::CustomItem 类型。项目的所有权仍归图形所有。选择在下一次selectedElementChanged
信号发出前有效。
返回所选自定义项的指针或 null。
另请参阅 selectedElement 。
qsizetype Q3DGraphsWidgetItem::selectedCustomItemIndex() const
在接收到selectedElementChanged
信号后,可用于查询所选自定义项的索引,Q3DGraphsWidgetItem::ElementType::CustomItem 类型。选择有效,直到下一个selectedElementChanged
信号发出。
返回选中的自定义项的索引或-1。
另请参阅 selectedElement 。
int Q3DGraphsWidgetItem::selectedLabelIndex() const
可用于在接收到selectedElementChanged
信号后查询所选标签的索引,标签类型不限。选择有效期至下一个selectedElementChanged
信号发出。
返回所选标签的索引或-1。
另请参阅 selectedElement 。
void Q3DGraphsWidgetItem::setCameraPosition(float horizontal, float vertical, float zoom = 100.0f)
horizontal 和vertical 定义了要使用的摄像机旋转角度。可选择zoom 参数,在minCameraZoomLevel 和maxCameraZoomLevel 属性定义的范围内设置摄像机的缩放百分比。
void Q3DGraphsWidgetItem::setWidget(QQuickWidget *widget)
设置给定的widget 实例作为 widget 项目的QQuickWidget 。图形将被设置为QQuickWidget 的内容。
图形只能在使用 QQuickWidgets 的 widget 应用程序中呈现。
使用示例:
QQuickWidget quickwidget; Q3DBarsWidgetItem graph; graph.setWidget(&quickwidget);
另请参阅 widget().
QList<QGraphsTheme *> Q3DGraphsWidgetItem::themes() const
返回所有已添加主题的列表。
另请参阅 addTheme()。
QQuickWidget *Q3DGraphsWidgetItem::widget() const
返回指向已为 widget 项目设置的QQuickWidget 实例的指针。
另请参阅 setWidget()。
© 2025 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.