diff options
Diffstat (limited to 'src/datavisualization/data/qcustom3ditem.cpp')
-rw-r--r-- | src/datavisualization/data/qcustom3ditem.cpp | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/src/datavisualization/data/qcustom3ditem.cpp b/src/datavisualization/data/qcustom3ditem.cpp index f39a0478..f1307d7a 100644 --- a/src/datavisualization/data/qcustom3ditem.cpp +++ b/src/datavisualization/data/qcustom3ditem.cpp @@ -62,15 +62,31 @@ QT_BEGIN_NAMESPACE_DATAVISUALIZATION /*! \qmlproperty vector3d Custom3DItem::position * - * Holds the item \a position as a vector3d. Item position is in data coordinates. Defaults to - * \c {vector3d(0.0, 0.0, 0.0)}. + * Holds the item \a position as a vector3d. Defaults to \c {vector3d(0.0, 0.0, 0.0)}. * - * \note Items positioned outside axis ranges are not rendered. + * Item position is either in data coordinates or in absolute coordinates, depending on + * positionAbsolute property. When using absolute coordinates, values between \c{-1.0...1.0} are + * within axis ranges. + * + * \note Items positioned outside any axis range are not rendered if positionAbsolute is \c{false}. + * + * \sa positionAbsolute + */ + +/*! \qmlproperty bool Custom3DItem::positionAbsolute + * + * This property dictates if item position is to be handled in data coordinates or in absolute + * coordinates. Defaults to \c{false}. Items with absolute cooridnates will always be rendered, + * whereas items with data coordinates are only rendered if they are within axis ranges. + * + * \sa position */ /*! \qmlproperty vector3d Custom3DItem::scaling * * Holds the item \a scaling as a vector3d. Defaults to \c {vector3d(0.1, 0.1, 0.1)}. + * The default value sets the item to 10% of the height of the graph, provided the item size is + * normalized. */ /*! \qmlproperty quaternion Custom3DItem::rotation @@ -148,10 +164,15 @@ QString QCustom3DItem::meshFile() const /*! \property QCustom3DItem::position * - * Holds the item \a position as a QVector3D. Item position is in data coordinates. Defaults to - * \c {QVector3D(0.0, 0.0, 0.0)}. + * Holds the item \a position as a QVector3D. Defaults to \c {QVector3D(0.0, 0.0, 0.0)}. + * + * Item position is either in data coordinates or in absolute coordinates, depending on + * positionAbsolute property. When using absolute coordinates, values between \c{-1.0...1.0} are + * within axis ranges. + * + * \note Items positioned outside any axis range are not rendered if positionAbsolute is \c{false}. * - * \note Items positioned outside axis ranges are not rendered. + * \sa positionAbsolute */ void QCustom3DItem::setPosition(const QVector3D &position) { @@ -168,9 +189,34 @@ QVector3D QCustom3DItem::position() const return d_ptr->m_position; } +/*! \property QCustom3DItem::positionAbsolute + * + * This property dictates if item position is to be handled in data coordinates or in absolute + * coordinates. Defaults to \c{false}. Items with absolute cooridnates will always be rendered, + * whereas items with data coordinates are only rendered if they are within axis ranges. + * + * \sa position + */ +void QCustom3DItem::setPositionAbsolute(bool positionAbsolute) +{ + if (d_ptr->m_positionAbsolute != positionAbsolute) { + d_ptr->m_positionAbsolute = positionAbsolute; + d_ptr->m_dirtyBits.positionAbsoluteDirty = true; + emit positionAbsoluteChanged(positionAbsolute); + emit d_ptr->needUpdate(); + } +} + +bool QCustom3DItem::isPositionAbsolute() const +{ + return d_ptr->m_positionAbsolute; +} + /*! \property QCustom3DItem::scaling * * Holds the item \a scaling as a QVector3D. Defaults to \c {QVector3D(0.1, 0.1, 0.1)}. + * The default value sets the item to 10% of the height of the graph, provided the item size is + * normalized. */ void QCustom3DItem::setScaling(const QVector3D &scaling) { @@ -313,6 +359,7 @@ QCustom3DItemPrivate::QCustom3DItemPrivate(QCustom3DItem *q, QObject *parent) : QObject(parent), q_ptr(q), m_position(QVector3D(0.0f, 0.0f, 0.0f)), + m_positionAbsolute(false), m_scaling(QVector3D(0.1f, 0.1f, 0.1f)), m_rotation(QQuaternion(0.0f, 0.0f, 0.0f, 0.0f)), m_visible(true), @@ -327,6 +374,7 @@ QCustom3DItemPrivate::QCustom3DItemPrivate(QCustom3DItem *q, const QString &mesh q_ptr(q), m_meshFile(meshFile), m_position(position), + m_positionAbsolute(false), m_scaling(scaling), m_rotation(rotation), m_visible(true), @@ -354,6 +402,7 @@ void QCustom3DItemPrivate::resetDirtyBits() m_dirtyBits.textureDirty = false; m_dirtyBits.meshDirty = false; m_dirtyBits.positionDirty = false; + m_dirtyBits.positionAbsoluteDirty = false; m_dirtyBits.scalingDirty = false; m_dirtyBits.rotationDirty = false; m_dirtyBits.visibleDirty = false; |