diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-08-10 13:25:11 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-08-20 13:59:12 +0000 |
commit | 907c2db46915eedac02f2a5a26291d2ce19282f9 (patch) | |
tree | 633734fcfacb6b48e626fdd0ee74baf20d2a221a /src/svg/qsvggraphics_p.h | |
parent | bb80aeee1fb19445889210ec913046d0ca385721 (diff) | |
download | qtsvg-907c2db46915eedac02f2a5a26291d2ce19282f9.tar.gz |
Fix parsing of forward referrals in use elements
SVG <use> elements may refer to a node that is defined later in the
file. The parser would then fail to resolve the link. Implement
delayed link resolution in the parser to handle such cases.
Task-number: QTBUG-69694
Change-Id: I94ffb3511dbd0fac822bb56991415b2d99ccf90e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/svg/qsvggraphics_p.h')
-rw-r--r-- | src/svg/qsvggraphics_p.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/svg/qsvggraphics_p.h b/src/svg/qsvggraphics_p.h index 33b5154..6e5b9d6 100644 --- a/src/svg/qsvggraphics_p.h +++ b/src/svg/qsvggraphics_p.h @@ -237,13 +237,20 @@ class QSvgUse : public QSvgNode { public: QSvgUse(const QPointF &start, QSvgNode *parent, QSvgNode *link); + QSvgUse(const QPointF &start, QSvgNode *parent, const QString &linkId) + : QSvgUse(start, parent, nullptr) + { m_linkId = linkId; } void draw(QPainter *p, QSvgExtraStates &states) override; Type type() const override; QRectF bounds(QPainter *p, QSvgExtraStates &states) const override; + bool isResolved() const { return m_link != nullptr; } + QString linkId() const { return m_linkId; } + void setLink(QSvgNode *link) { m_link = link; } private: QSvgNode *m_link; QPointF m_start; + QString m_linkId; }; class QSvgVideo : public QSvgNode |