Custom3DItem QML Type
向图表中添加自定义项。更多
| Import Statement: | import QtGraphs |
| In C++: | QCustom3DItem |
| Inherited By: |
- 所有成员(包括继承成员)的列表
- Custom3DItem 是Qt Graphs QML Types for 3D 的一部分。
属性
- meshFile : string
- position : vector3d
- positionAbsolute : bool
- rotation : quaternion
- rotationAbsolute : bool
(since 6.11) - scaling : vector3d
- scalingAbsolute : bool
- shadowCasting : bool
- textureFile : string
- visible : bool
信号
- meshFileChanged(string meshFile)
- positionAbsoluteChanged(bool positionAbsolute)
- positionChanged(vector3d position)
- rotationChanged(quaternion rotation)
- scalingAbsoluteChanged(bool scalingAbsolute)
- scalingChanged(vector3d scaling)
- shadowCastingChanged(bool shadowCasting)
- textureFileChanged(string textureFile)
- visibleChanged(bool visible)
方法
- void setRotationAxisAndAngle(vector3d axis, real angle)
详细说明
自定义项目具有自定义网格、位置、缩放、旋转和可选纹理。
属性文档
meshFile : string
项目网格文件名。文件中的项目必须是网格格式。建议网格文件包含顶点、法线和 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) 。
rotationAbsolute : bool [since 6.11]
定义项目旋转是以数据值还是以绝对值处理。默认值为true 。采用绝对旋转的项目将按照默认坐标旋转,与轴无关。使用数据旋转的项目将根据轴坐标旋转。
此属性在 Qt 6.11 中引入。
另请参阅 rotation 。
scaling : vector3d
项目缩放为vector3d 类型。默认为vector3d(0.1, 0.1, 0.1) 。
根据scalingAbsolute 属性的值,可以用数据值或绝对值指定项目缩放比例。默认向量解释为绝对值时,会将项目设置为图形高度的 10%,前提是项目网格已归一化,且图形纵横比未从默认值中更改。
注: Custom3DLabel 项目或polar 图形中使用的自定义项目仅支持绝对缩放。
注: 在 Qt 6.8 中,模型被错误地假定为默认缩放为 1 (-0.5...0.5),而实际上是缩放为 2 (-1...1)。因此,从 Qt 6.9 开始,所有自定义项的大小都是 Qt 6.8 的两倍。
另请参见 scalingAbsolute 。
scalingAbsolute : bool
定义是以数据值还是绝对值来处理项目缩放。默认值为true 。无论坐标轴范围如何,采用绝对缩放比例的项目都将以相同大小呈现。采用数据缩放的项目将根据坐标轴范围改变其视图大小。如果positionAbsolute 为true ,该属性将被忽略,缩放比例将被解释为绝对值。如果项目有旋转,则数据缩放是根据未旋转的项目计算的。同样,对于Custom3DVolume 项目,范围缩放是在未旋转的项目上计算的。
注: Custom3DLabel 项目或polar 图表中使用的自定义项目仅支持绝对缩放。
注: 自定义项的网格必须归一化为范围[-1 ,1] ,否则数据缩放将不准确。
另请参阅 scaling 和positionAbsolute 。
shadowCasting : bool
定义是否启用项目的阴影投射。默认为true 。如果false ,则无论ShadowQuality 与否,项目都不会投射阴影。
textureFile : string
项目的纹理文件名。如果不设置,将使用纯灰色纹理。
注: 为节省内存,创建纹理后,将清除从文件加载的QImage 。
visible : bool
项目的可见性。默认为true 。
信号文档
meshFileChanged(string meshFile)
当meshFile 更改为meshFile 时会发出该信号。
注: 相应的处理程序是onMeshFileChanged 。
positionAbsoluteChanged(bool positionAbsolute)
当positionAbsolute 更改为positionAbsolute 时会发出该信号。
注: 相应的处理程序是onPositionAbsoluteChanged 。
positionChanged(vector3d position)
当position 变更为position 时,将发出此信号。
注: 相应的处理程序是onPositionChanged 。
rotationChanged(quaternion rotation)
当rotation 更改为rotation 时会发出该信号。
注: 相应的处理程序是onRotationChanged 。
scalingAbsoluteChanged(bool scalingAbsolute)
当scalingAbsolute 更改为scalingAbsolute 时会发出该信号。
注: 相应的处理程序是onScalingAbsoluteChanged 。
scalingChanged(vector3d scaling)
当scaling 更改为scaling 时会发出该信号。
注: 相应的处理程序是onScalingChanged 。
shadowCastingChanged(bool shadowCasting)
当shadowCasting 更改为shadowCasting 时会发出该信号。
注: 相应的处理程序是onShadowCastingChanged 。
textureFileChanged(string textureFile)
当textureFile 更改为textureFile 时会发出该信号。
注: 相应的处理程序是onTextureFileChanged 。
visibleChanged(bool visible)
当visible 更改为visible 时会发出该信号。
注: 相应的处理程序是onVisibleChanged 。
方法文档
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.