Custom3DItem QML Type
向图表中添加自定义项。更多
| Import Statement: | import QtDataVisualization 1.11 |
| Since: | QtDataVisualization 1.1 |
| In C++: | QCustom3DItem |
| Inherited By: |
属性
- meshFile : string
- position : vector3d
- positionAbsolute : bool
- rotation : quaternion
- scaling : vector3d
- scalingAbsolute : bool
(since QtDataVisualization 1.2) - shadowCasting : bool
- textureFile : string
- visible : bool
方法
- void setRotationAxisAndAngle(vector3d axis, real angle)
详细说明
自定义项目具有自定义网格、位置、缩放、旋转和可选纹理。
属性文档
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.