diff options
author | Matthias Rauter <matthias.rauter@qt.io> | 2023-07-18 12:59:27 +0200 |
---|---|---|
committer | Hatem ElKharashy <hatem.elkharashy@qt.io> | 2023-09-20 15:20:09 +0300 |
commit | a7a08b157e4d63603b4dd4cf1b3a79a825a37108 (patch) | |
tree | b0dedfdcb036d78f981fd2e6adbfddc31f423931 /src/svg/qsvgtinydocument.cpp | |
parent | 3fd27ee0d38ade9fd1f8848b410fce4181f02b2c (diff) |
Add selectable featureSet to all QSvg classes
In preparation of adding additional svg elements, that go beyond the Tiny
1.2 standard, a member variable and respective getters and setters are
added to all relevant classes to let the application developers decide
which SVG features they want to be parsed.
Task-number: QTBUG-115223
Change-Id: Ia862548de815ca67e3ae8939141dc60f31696bb2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/svg/qsvgtinydocument.cpp')
-rw-r--r-- | src/svg/qsvgtinydocument.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp index 176ff3c..b548d19 100644 --- a/src/svg/qsvgtinydocument.cpp +++ b/src/svg/qsvgtinydocument.cpp @@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE -QSvgTinyDocument::QSvgTinyDocument() +QSvgTinyDocument::QSvgTinyDocument(QSvg::FeatureSet featureSet) : QSvgStructureNode(0) , m_widthPercent(false) , m_heightPercent(false) @@ -29,6 +29,7 @@ QSvgTinyDocument::QSvgTinyDocument() , m_animated(false) , m_animationDuration(0) , m_fps(30) + , m_featureSet(featureSet) { } @@ -152,7 +153,7 @@ static QByteArray qt_inflateSvgzDataFrom(QIODevice *) } #endif -QSvgTinyDocument * QSvgTinyDocument::load(const QString &fileName) +QSvgTinyDocument * QSvgTinyDocument::load(const QString &fileName, QSvg::FeatureSet featureSet) { QFile file(fileName); if (!file.open(QFile::ReadOnly)) { @@ -167,7 +168,7 @@ QSvgTinyDocument * QSvgTinyDocument::load(const QString &fileName) } QSvgTinyDocument *doc = nullptr; - QSvgHandler handler(&file); + QSvgHandler handler(&file, featureSet); if (handler.ok()) { doc = handler.document(); doc->m_animationDuration = handler.animationDuration(); @@ -179,7 +180,7 @@ QSvgTinyDocument * QSvgTinyDocument::load(const QString &fileName) return doc; } -QSvgTinyDocument * QSvgTinyDocument::load(const QByteArray &contents) +QSvgTinyDocument * QSvgTinyDocument::load(const QByteArray &contents, QSvg::FeatureSet featureSet) { QByteArray svg; // Check for gzip magic number and inflate if appropriate @@ -196,7 +197,7 @@ QSvgTinyDocument * QSvgTinyDocument::load(const QByteArray &contents) QBuffer buffer; buffer.setData(svg); buffer.open(QIODevice::ReadOnly); - QSvgHandler handler(&buffer); + QSvgHandler handler(&buffer, featureSet ); QSvgTinyDocument *doc = nullptr; if (handler.ok()) { @@ -208,9 +209,9 @@ QSvgTinyDocument * QSvgTinyDocument::load(const QByteArray &contents) return doc; } -QSvgTinyDocument * QSvgTinyDocument::load(QXmlStreamReader *contents) +QSvgTinyDocument * QSvgTinyDocument::load(QXmlStreamReader *contents, QSvg::FeatureSet featureSet) { - QSvgHandler handler(contents); + QSvgHandler handler(contents, featureSet); QSvgTinyDocument *doc = nullptr; if (handler.ok()) { @@ -339,6 +340,11 @@ void QSvgTinyDocument::setViewBox(const QRectF &rect) m_implicitViewBox = rect.isNull(); } +QSvg::FeatureSet QSvgTinyDocument::featureSet() const +{ + return m_featureSet; +} + void QSvgTinyDocument::addSvgFont(QSvgFont *font) { m_fonts.insert(font->familyName(), font); |