diff options
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsitemanimation.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitemanimation.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp index 572ec141bc..ad77e2f260 100644 --- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp +++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp @@ -115,7 +115,7 @@ public: QGraphicsItem *item; QPointF startPos; - QMatrix startMatrix; + QTransform startTransform; qreal step; @@ -294,23 +294,38 @@ QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::posList() const return list; } +#if QT_DEPRECATED_SINCE(5, 14) /*! Returns the matrix used to transform the item at the specified \a step value. + + \obsolete Use transformAt() instead */ QMatrix QGraphicsItemAnimation::matrixAt(qreal step) const { check_step_valid(step, "matrixAt"); + return transformAt(step).toAffine(); +} +#endif + +/*! + Returns the transform used for the item at the specified \a step value. + + \since 5.14 +*/ +QTransform QGraphicsItemAnimation::transformAt(qreal step) const +{ + check_step_valid(step, "transformAt"); - QMatrix matrix; + QTransform transform; if (!d->rotation.isEmpty()) - matrix.rotate(rotationAt(step)); + transform.rotate(rotationAt(step)); if (!d->verticalScale.isEmpty()) - matrix.scale(horizontalScaleAt(step), verticalScaleAt(step)); + transform.scale(horizontalScaleAt(step), verticalScaleAt(step)); if (!d->verticalShear.isEmpty()) - matrix.shear(horizontalShearAt(step), verticalShearAt(step)); + transform.shear(horizontalShearAt(step), verticalShearAt(step)); if (!d->xTranslation.isEmpty()) - matrix.translate(xTranslationAt(step), yTranslationAt(step)); - return matrix; + transform.translate(xTranslationAt(step), yTranslationAt(step)); + return transform; } /*! @@ -542,13 +557,14 @@ void QGraphicsItemAnimation::setStep(qreal step) || !d->horizontalShear.isEmpty() || !d->xTranslation.isEmpty() || !d->yTranslation.isEmpty()) { - d->item->setMatrix(d->startMatrix * matrixAt(step)); + d->item->setTransform(d->startTransform * transformAt(step)); } } afterAnimationStep(step); } +#if QT_DEPRECATED_SINCE(5, 13) /*! Resets the item to its starting position and transformation. @@ -561,8 +577,9 @@ void QGraphicsItemAnimation::reset() if (!d->item) return; d->startPos = d->item->pos(); - d->startMatrix = d->item->matrix(); + d->startTransform = d->item->transform(); } +#endif /*! \fn void QGraphicsItemAnimation::beforeAnimationStep(qreal step) |