The QCustom3DItem class adds a custom item to a graph. 更多...
头: | #include <QCustom3DItem> |
Since: | QtDataVisualization 1.1 |
实例化: | Custom3DItem |
继承: | QObject |
继承者: | QCustom3DLabel and QCustom3DVolume |
|
|
QCustom3DItem (QObject * parent = nullptr) | |
QCustom3DItem (const QString & meshFile , const QVector3D & position , const QVector3D & scaling , const QQuaternion & rotation , const QImage & texture , QObject * parent = nullptr) | |
virtual | ~QCustom3DItem () |
bool | isPositionAbsolute () const |
bool | isScalingAbsolute () const |
bool | isShadowCasting () const |
bool | isVisible () const |
QString | meshFile () const |
QVector3D | position () const |
QQuaternion | rotation () |
QVector3D | scaling () const |
void | setMeshFile (const QString & meshFile ) |
void | setPosition (const QVector3D & position ) |
void | setPositionAbsolute (bool positionAbsolute ) |
void | setRotation (const QQuaternion & rotation ) |
void | setRotationAxisAndAngle (const QVector3D & axis , float angle ) |
void | setScaling (const QVector3D & scaling ) |
void | setScalingAbsolute (bool scalingAbsolute ) |
void | setShadowCasting (bool enabled ) |
void | setTextureFile (const QString & textureFile ) |
void | setTextureImage (const QImage & textureImage ) |
void | setVisible (bool visible ) |
QString | textureFile () const |
void | meshFileChanged (const QString & meshFile ) |
void | positionAbsoluteChanged (bool positionAbsolute ) |
void | positionChanged (const QVector3D & position ) |
void | rotationChanged (const QQuaternion & rotation ) |
void | scalingAbsoluteChanged (bool scalingAbsolute ) |
void | scalingChanged (const QVector3D & scaling ) |
void | shadowCastingChanged (bool shadowCasting ) |
void | textureFileChanged (const QString & textureFile ) |
void | visibleChanged (bool visible ) |
const QMetaObject | staticMetaObject |
QScopedPointer<QCustom3DItemPrivate> | d_ptr |
The QCustom3DItem class adds a custom item to a graph.
A custom item has a custom mesh, position, scaling, rotation, and an optional texture.
另请参阅 QAbstract3DGraph::addCustomItem ().
This property holds the item mesh file name.
The item in the file must be in Wavefront OBJ format and include vertices, normals, and UVs. It also needs to be in triangles.
访问函数:
QString | meshFile () const |
void | setMeshFile (const QString & meshFile ) |
通知程序信号:
void | meshFileChanged (const QString & meshFile ) |
This property holds the item position as a QVector3D .
默认为
QVector3D(0.0, 0.0, 0.0)
.
Item position is specified either in data coordinates or in absolute coordinates, depending on the
positionAbsolute
property. When using absolute coordinates, values between
-1.0...1.0
are within axis ranges.
注意:
Items positioned outside any axis range are not rendered if
positionAbsolute
is
false
, unless the item is a
QCustom3DVolume
that would be partially visible and
scalingAbsolute
is also
false
. In that case, the visible portion of the volume will be rendered.
访问函数:
QVector3D | 位置 () const |
void | setPosition (const QVector3D & position ) |
通知程序信号:
void | positionChanged (const QVector3D & position ) |
另请参阅 positionAbsolute .
This property holds whether item position is to be handled in data coordinates or in absolute coordinates.
默认为
false
. Items with absolute coordinates will always be rendered, whereas items with data coordinates are only rendered if they are within axis ranges.
访问函数:
bool | isPositionAbsolute () const |
void | setPositionAbsolute (bool positionAbsolute ) |
通知程序信号:
void | positionAbsoluteChanged (bool positionAbsolute ) |
另请参阅 position .
This property holds the item rotation as a QQuaternion .
默认为
QQuaternion(0.0, 0.0, 0.0, 0.0)
.
访问函数:
QQuaternion | rotation () |
void | setRotation (const QQuaternion & rotation ) |
通知程序信号:
void | rotationChanged (const QQuaternion & rotation ) |
This property holds the item scaling as a QVector3D .
默认为
QVector3D(0.1, 0.1, 0.1)
.
Item scaling is either in data values or in absolute values, depending on the scalingAbsolute property. The default vector interpreted as absolute values sets the item to 10% of the height of the graph, provided the item mesh is normalized and the graph aspect ratios have not been changed from the defaults.
访问函数:
QVector3D | scaling () const |
void | setScaling (const QVector3D & scaling ) |
通知程序信号:
void | scalingChanged (const QVector3D & scaling ) |
另请参阅 scalingAbsolute .
This property holds whether item scaling is to be handled in data values or in absolute values.
默认为
true
.
Items with absolute scaling will be rendered at the same size, regardless of axis ranges. Items with data scaling will change their apparent size according to the axis ranges. If
positionAbsolute
is
true
, this property is ignored and scaling is interpreted as an absolute value. If the item has rotation, the data scaling is calculated on the unrotated item. Similarly, for
QCustom3DVolume
items, the range clipping is calculated on the unrotated item.
注意: Only absolute scaling is supported for QCustom3DLabel items or for custom items used in polar 图形。
注意:
The custom item's mesh must be normalized to the range
[-1 ,1]
, or the data scaling will not be accurate.
该特性在 QtDataVisualization 1.2 引入。
访问函数:
bool | isScalingAbsolute () const |
void | setScalingAbsolute (bool scalingAbsolute ) |
通知程序信号:
void | scalingAbsoluteChanged (bool scalingAbsolute ) |
另请参阅 scaling and positionAbsolute .
This property holds whether shadow casting for the item is enabled.
默认为
true
。若
false
, the item does not cast shadows regardless of
QAbstract3DGraph::ShadowQuality
.
访问函数:
bool | isShadowCasting () const |
void | setShadowCasting (bool enabled ) |
通知程序信号:
void | shadowCastingChanged (bool shadowCasting ) |
This property holds the texture file name for the item.
If both this property and the texture image are unset, a solid gray texture will be used.
注意: To conserve memory, the QImage loaded from the file is cleared after a texture is created.
访问函数:
QString | textureFile () const |
void | setTextureFile (const QString & textureFile ) |
通知程序信号:
void | textureFileChanged (const QString & textureFile ) |
This property holds the visibility of the item.
默认为
true
.
访问函数:
bool | isVisible () const |
void | setVisible (bool visible ) |
通知程序信号:
void | visibleChanged (bool visible ) |
Constructs a custom 3D item with the specified parent .
Constructs a custom 3D item with the specified meshFile , position , scaling , rotation , texture image, and optional parent .
[虚拟]
QCustom3DItem::
~QCustom3DItem
()
删除自定义 3D 项。
A convenience function to construct the rotation quaternion from axis and angle .
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
另请参阅 rotation .
设置值为 textureImage 作为 QImage for the item. The texture defaults to solid gray.
注意: To conserve memory, the given QImage is cleared after a texture is created.