summaryrefslogtreecommitdiff
path: root/src/svg/qsvgrenderer.cpp
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-01-10 12:10:03 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-01-17 10:14:54 +0100
commit20befe6f00c84934a7ab9e9c27c8ac85cd0dac1d (patch)
treee3e9b3c49363d3f5078f87ec2e591c0cae48cdce /src/svg/qsvgrenderer.cpp
parent88f30c3f5be38fb9cb6886a683a71ae792e61c61 (diff)
downloadqtsvg-20befe6f00c84934a7ab9e9c27c8ac85cd0dac1d.tar.gz
Don't use deprecated QMatrix class anymore
Task-number: QTBUG-46653 Change-Id: I9944b62141d7054e3935000a819bebc5fd54df6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/svg/qsvgrenderer.cpp')
-rw-r--r--src/svg/qsvgrenderer.cpp36
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