本页内容

Custom3DItem QML Type

向图中添加自定义项。更多...

Import Statement: import QtDataVisualization 1.12
Since: QtDataVisualization 1.1
In C++: QCustom3DItem
Inherited By:

Custom3DLabel and Custom3DVolume

Status: Deprecated

此类型已弃用。我们强烈建议不要在新代码中使用它。

属性

方法

详细描述

自定义项具有自定义网格、位置、缩放、旋转以及可选的纹理。

属性文档

meshFile : string

该物品的网格文件名。文件中的物品必须为 Wavefront OBJ 格式,并包含顶点、法线和 UV 坐标。此外,该物品必须由三角面组成。如果文件缺少法线或 UV 坐标,加载将失败,控制台输出将显示一条错误信息,且该物品将无法渲染。

position : vector3d

项目位置,类型为vector3d 。默认值为vector3d(0.0, 0.0, 0.0) 。

项目位置可通过数据坐标或绝对坐标指定,具体取决于positionAbsolute 属性的值。使用绝对坐标时,-1.0...1.0 之间的数值均在轴范围内。

注意: 如果positionAbsolute 的值为false ,且项目 位于任何轴范围之外,则该项目 不会被渲染;除非该项目是Custom3DVolume(此时会部分可见),且scalingAbsolute 的值也为false 。在这种情况下,体积的可见部分将被渲染。

另请参阅 positionAbsolute 和scalingAbsolute 。

positionAbsolute : bool

用于指定项目位置应采用数据坐标还是绝对坐标进行处理。默认值为false 。采用绝对坐标的项目将始终被渲染,而采用数据坐标的项目仅在位于轴范围之内时才会被渲染。

另请参阅 position 。

rotation : quaternion

该项的轮换方式为“quaternion ”。默认值为“quaternion(0.0, 0.0, 0.0, 0.0) ”。

scaling : vector3d

项目缩放采用vector3d 类型。默认值为vector3d(0.1, 0.1, 0.1) 。

项目缩放可通过数据值或绝对值进行指定,具体取决于scalingAbsolute 属性的值。默认向量被解释为绝对值,会将项目设置为图表高度的10%,前提是项目网格已归一化,且图表的宽高比未从默认值进行更改。

另请参阅 scalingAbsolute 。

scalingAbsolute : bool [since QtDataVisualization 1.2]

定义项目缩放应基于数据值还是绝对值进行处理。默认值为true 。采用绝对缩放的项目将以相同大小渲染,无论坐标轴范围如何。 采用数据缩放的元素会根据坐标轴范围调整其显示大小。如果positionAbsolute 的值为true ,则忽略此属性,并将缩放视为绝对值。如果元素存在旋转,则数据缩放是基于未旋转的元素计算的。同样,对于Custom3DVolume元素,范围裁剪也是基于未旋转的元素计算的。

注意: Custom3DLabel 项或用于polar 图表中的自定义项仅 支持绝对缩放。

注意: 自定义项 的网格 必须归一化到范围[-1 ,1] 内,否则数据缩放将不准确。

此属性在 QtDataVisualization 1.2 中引入。

另请参阅 scaling 和positionAbsolute 。

shadowCasting : bool

指定是否启用该项的投影功能。默认值为true 。如果false ,则无论ShadowQuality 如何设置,该项均不投射阴影。

textureFile : string

该物品的纹理文件名。如果未设置,则将使用纯灰色纹理。

注意:为 节省内存,从文件加载的QImage 在纹理创建完成后将被清空。

visible : bool

该项的可见性。默认值为true 。

方法文档

void setRotationAxisAndAngle(vector3d axis, real angle)

一个便捷函数,用于根据axis 和angle 构建旋转四元数。

另请参阅 rotation 。

© 2026 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.