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
- 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)
。
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 与否,项目都不会投射阴影。
visible : bool |
项目的可见性。默认为true
。
信号文档
positionAbsoluteChanged(bool positionAbsolute) |
当positionAbsolute 变更为positionAbsolute 时发出此信号。
注: 相应的处理程序是onPositionAbsoluteChanged
。
rotationChanged(quaternion rotation) |
当rotation 变更为rotation 时,发出该信号。
注: 相应的处理程序是onRotationChanged
。
scalingAbsoluteChanged(bool scalingAbsolute) |
当scalingAbsolute 变更为scalingAbsolute 时,发出该信号。
注: 相应的处理程序是onScalingAbsoluteChanged
。
shadowCastingChanged(bool shadowCasting) |
当shadowCasting 变更为shadowCasting 时,发出该信号。
注: 相应的处理程序是onShadowCastingChanged
。
textureFileChanged(string textureFile) |
当textureFile 变更为textureFile 时,发出此信号。
注: 相应的处理程序是onTextureFileChanged
。
方法文档
方便函数,用于从axis 和angle 构建旋转四元数。
另请参见 rotation 。
© 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.