diff options
Diffstat (limited to 'src/svg/qsvgrenderer.cpp')
-rw-r--r-- | src/svg/qsvgrenderer.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/svg/qsvgrenderer.cpp b/src/svg/qsvgrenderer.cpp index da31a31..40ae6ab 100644 --- a/src/svg/qsvgrenderer.cpp +++ b/src/svg/qsvgrenderer.cpp @@ -45,6 +45,7 @@ #include "qbytearray.h" #include "qtimer.h" +#include "qtransform.h" #include "qdebug.h" #include "private/qobject_p.h" @@ -437,7 +438,7 @@ void QSvgRenderer::setViewBox(const QRectF &viewbox) The transformation matrix of parent elements is not affecting the bounds of the element. - \sa matrixForElement() + \sa transformForElement() */ QRectF QSvgRenderer::boundsOnElement(const QString &id) const { @@ -471,8 +472,15 @@ bool QSvgRenderer::elementExists(const QString &id) const return exists; } +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED /*! \since 4.2 + \deprecated + + Use transformForElement() instead. + Returns the transformation matrix for the element with the given \a id. The matrix is a product of @@ -486,11 +494,31 @@ bool QSvgRenderer::elementExists(const QString &id) const */ QMatrix QSvgRenderer::matrixForElement(const QString &id) const { + return transformForElement(id).toAffine(); +} +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) + +/*! + \since 5.15 + + Returns the transformation matrix for the element + with the given \a id. The matrix is a product of + the transformation of the element's parents. The transformation of + the element itself is not included. + + To find the bounding rectangle of the element in logical coordinates, + you can apply the matrix on the rectangle returned from boundsOnElement(). + + \sa boundsOnElement() +*/ +QTransform QSvgRenderer::transformForElement(const QString &id) const +{ Q_D(const QSvgRenderer); - QMatrix mat; + QTransform trans; if (d->render) - mat = d->render->matrixForElement(id); - return mat; + trans = d->render->transformForElement(id); + return trans; } QT_END_NAMESPACE |