summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-08-11 10:21:35 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-08-11 10:21:35 +0200
commit019e855ddd54a9f684f0567dd9d5fb8844462ce2 (patch)
tree07174c42db1e6cc9df544671bcdc92dc97292734 /src
parent9fd486637caa7f3064561ad02f02241284a26f66 (diff)
parentb80a1676c9f5cc0b428f15ac09f6648a80aacb26 (diff)
downloadqtsvg-019e855ddd54a9f684f0567dd9d5fb8844462ce2.tar.gz
Merge remote-tracking branch 'origin/dev' into wip/qt6
Change-Id: I4a9a175cb431cb3d38146e98cf08d7042dcc8f2b
Diffstat (limited to 'src')
-rw-r--r--src/plugins/imageformats/svg/qsvgiohandler.cpp4
-rw-r--r--src/plugins/imageformats/svg/qsvgiohandler.h2
-rw-r--r--src/svg/doc/qtsvg.qdocconf1
-rw-r--r--src/svg/qsvgtinydocument.cpp19
-rw-r--r--src/svg/qsvgtinydocument_p.h4
5 files changed, 16 insertions, 14 deletions
diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp
index a999d47..6999d51 100644
--- a/src/plugins/imageformats/svg/qsvgiohandler.cpp
+++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp
@@ -140,12 +140,12 @@ bool QSvgIOHandler::canRead() const
return false;
}
-
+#if QT_DEPRECATED_SINCE(5, 13)
QByteArray QSvgIOHandler::name() const
{
return "svg";
}
-
+#endif
bool QSvgIOHandler::read(QImage *image)
{
diff --git a/src/plugins/imageformats/svg/qsvgiohandler.h b/src/plugins/imageformats/svg/qsvgiohandler.h
index fdafa0a..5fdf6ee 100644
--- a/src/plugins/imageformats/svg/qsvgiohandler.h
+++ b/src/plugins/imageformats/svg/qsvgiohandler.h
@@ -58,7 +58,9 @@ public:
QSvgIOHandler();
~QSvgIOHandler();
bool canRead() const override;
+#if QT_DEPRECATED_SINCE(5, 13)
QByteArray name() const override;
+#endif
bool read(QImage *image) override;
static bool canRead(QIODevice *device);
QVariant option(ImageOption option) const override;
diff --git a/src/svg/doc/qtsvg.qdocconf b/src/svg/doc/qtsvg.qdocconf
index b180daa..1254d61 100644
--- a/src/svg/doc/qtsvg.qdocconf
+++ b/src/svg/doc/qtsvg.qdocconf
@@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtsvg.qdocconf)
project = QtSvg
description = Qt SVG Reference Documentation
diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp
index 77aafb4..3143ad2 100644
--- a/src/svg/qsvgtinydocument.cpp
+++ b/src/svg/qsvgtinydocument.cpp
@@ -60,6 +60,7 @@ QSvgTinyDocument::QSvgTinyDocument()
: QSvgStructureNode(0)
, m_widthPercent(false)
, m_heightPercent(false)
+ , m_time(0)
, m_animated(false)
, m_animationDuration(0)
, m_fps(30)
@@ -230,9 +231,8 @@ QSvgTinyDocument * QSvgTinyDocument::load(QXmlStreamReader *contents)
void QSvgTinyDocument::draw(QPainter *p, const QRectF &bounds)
{
- if (m_time.isNull()) {
- m_time.start();
- }
+ if (m_time == 0)
+ m_time = QDateTime::currentMSecsSinceEpoch();
if (displayMode() == QSvgNode::NoneMode)
return;
@@ -269,9 +269,8 @@ void QSvgTinyDocument::draw(QPainter *p, const QString &id,
qCDebug(lcSvgHandler, "Couldn't find node %s. Skipping rendering.", qPrintable(id));
return;
}
- if (m_time.isNull()) {
- m_time.start();
- }
+ if (m_time == 0)
+ m_time = QDateTime::currentMSecsSinceEpoch();
if (node->displayMode() == QSvgNode::NoneMode)
return;
@@ -377,7 +376,7 @@ QSvgFillStyleProperty *QSvgTinyDocument::namedStyle(const QString &id) const
void QSvgTinyDocument::restartAnimation()
{
- m_time.restart();
+ m_time = QDateTime::currentMSecsSinceEpoch();
}
bool QSvgTinyDocument::animated() const
@@ -491,7 +490,7 @@ QMatrix QSvgTinyDocument::matrixForElement(const QString &id) const
int QSvgTinyDocument::currentFrame() const
{
- double runningPercentage = qMin(m_time.elapsed()/double(m_animationDuration), 1.);
+ double runningPercentage = qMin(currentElapsed() / double(m_animationDuration), 1.);
int totalFrames = m_fps * m_animationDuration;
@@ -504,8 +503,8 @@ void QSvgTinyDocument::setCurrentFrame(int frame)
double framePercentage = frame/double(totalFrames);
double timeForFrame = m_animationDuration * framePercentage; //in S
timeForFrame *= 1000; //in ms
- int timeToAdd = int(timeForFrame - m_time.elapsed());
- m_time = m_time.addMSecs(timeToAdd);
+ int timeToAdd = int(timeForFrame - currentElapsed());
+ m_time += timeToAdd;
}
void QSvgTinyDocument::setFramesPerSecond(int num)
diff --git a/src/svg/qsvgtinydocument_p.h b/src/svg/qsvgtinydocument_p.h
index 5f5d06b..404587d 100644
--- a/src/svg/qsvgtinydocument_p.h
+++ b/src/svg/qsvgtinydocument_p.h
@@ -132,7 +132,7 @@ private:
QHash<QString, QSvgNode *> m_namedNodes;
QHash<QString, QSvgRefCounter<QSvgFillStyleProperty> > m_namedStyles;
- QTime m_time;
+ qint64 m_time;
bool m_animated;
int m_animationDuration;
int m_fps;
@@ -189,7 +189,7 @@ inline bool QSvgTinyDocument::preserveAspectRatio() const
inline int QSvgTinyDocument::currentElapsed() const
{
- return m_time.elapsed();
+ return QDateTime::currentMSecsSinceEpoch() - m_time;
}
inline int QSvgTinyDocument::animationDuration() const