diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/plugins/imageformats/svg/qsvgiohandler.cpp | 4 | ||||
-rw-r--r-- | src/svg/doc/qtsvg.qdocconf | 2 | ||||
-rw-r--r-- | src/svg/qsvgfunctions_wince.cpp | 4 | ||||
-rw-r--r-- | src/svg/qsvggraphics.cpp | 7 | ||||
-rw-r--r-- | src/svg/qsvghandler.cpp | 7 | ||||
-rw-r--r-- | src/svg/svg.pro | 5 | ||||
-rw-r--r-- | tests/auto/qicon_svg/icons/triangle.svg | 12 | ||||
-rw-r--r-- | tests/auto/qicon_svg/tst_qicon_svg.cpp | 1 |
9 files changed, 28 insertions, 16 deletions
diff --git a/.qmake.conf b/.qmake.conf index 58db72c..fc13c75 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) CONFIG += qt_example_installs CONFIG += warning_clean -MODULE_VERSION = 5.5.1 +MODULE_VERSION = 5.6.0 diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp index 8790796..8a9cbb2 100644 --- a/src/plugins/imageformats/svg/qsvgiohandler.cpp +++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp @@ -122,7 +122,7 @@ bool QSvgIOHandler::canRead() const if (buf.startsWith("\x1f\x8b")) { setFormat("svgz"); return true; - } else if (buf.contains("<?xml") || buf.contains("<svg")) { + } else if (buf.contains("<?xml") || buf.contains("<svg") || buf.contains("<!--")) { setFormat("svg"); return true; } @@ -251,7 +251,7 @@ bool QSvgIOHandler::supportsOption(ImageOption option) const bool QSvgIOHandler::canRead(QIODevice *device) { QByteArray buf = device->peek(8); - return buf.startsWith("\x1f\x8b") || buf.contains("<?xml") || buf.contains("<svg"); + return buf.startsWith("\x1f\x8b") || buf.contains("<?xml") || buf.contains("<svg") || buf.contains("<!--"); } QT_END_NAMESPACE diff --git a/src/svg/doc/qtsvg.qdocconf b/src/svg/doc/qtsvg.qdocconf index 181c6a7..e8460e9 100644 --- a/src/svg/doc/qtsvg.qdocconf +++ b/src/svg/doc/qtsvg.qdocconf @@ -39,7 +39,7 @@ sourcedirs += .. \ exampledirs += ../../../examples/svg \ snippets/ -examplesinstallpath = svg +examplesinstallpath = qtsvg/svg imagedirs += images diff --git a/src/svg/qsvgfunctions_wince.cpp b/src/svg/qsvgfunctions_wince.cpp index 108c31f..d2e63ca 100644 --- a/src/svg/qsvgfunctions_wince.cpp +++ b/src/svg/qsvgfunctions_wince.cpp @@ -36,7 +36,9 @@ #include <winbase.h> #include <kfuncs.h> #include <stdio.h> +#if _WIN32_WCE < 0x800 #include <altcecrt.h> +#endif #include "qplatformdefs.h" #include "qsvgfunctions_wince_p.h" @@ -51,6 +53,7 @@ extern "C" { #endif // File I/O --------------------------------------------------------- +#if _WIN32_WCE < 0x800 int errno = 0; int qt_wince_open(const char *filename, int oflag, int pmode) @@ -116,6 +119,7 @@ int qt_wince__close(int handle) return 0; return fclose((FILE*)handle); } +#endif #ifdef __cplusplus } // extern "C" diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index 3a3830d..e297a76 100644 --- a/src/svg/qsvggraphics.cpp +++ b/src/svg/qsvggraphics.cpp @@ -311,9 +311,8 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) bool appendSpace = false; QVector<QString> paragraphs; QStack<QTextCharFormat> formats; - QVector<QList<QTextLayout::FormatRange> > formatRanges; + QVector<QVector<QTextLayout::FormatRange> > formatRanges(1); paragraphs.push_back(QString()); - formatRanges.push_back(QList<QTextLayout::FormatRange>()); for (int i = 0; i < m_tspans.size(); ++i) { if (m_tspans[i] == LINEBREAK) { @@ -332,7 +331,7 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) } appendSpace = false; paragraphs.push_back(QString()); - formatRanges.push_back(QList<QTextLayout::FormatRange>()); + formatRanges.resize(formatRanges.size() + 1); } } else { WhitespaceMode mode = m_tspans[i]->whitespaceMode(); @@ -394,7 +393,7 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) QTextOption op = tl.textOption(); op.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); tl.setTextOption(op); - tl.setAdditionalFormats(formatRanges[i]); + tl.setFormats(formatRanges[i]); tl.beginLayout(); forever { diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 4f8c172..d373a99 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -62,8 +62,6 @@ QT_BEGIN_NAMESPACE static const char *qt_inherit_text = "inherit"; #define QT_INHERIT QLatin1String(qt_inherit_text) -Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok); - // ======== duplicated from qcolor_p static inline int qsvg_h2i(char hex) @@ -627,8 +625,7 @@ static qreal toDouble(const QChar *&str) if (neg) val = -val; } else { - bool ok = false; - val = qstrtod(temp, 0, &ok); + val = QByteArray::fromRawData(temp, pos).toDouble(); } return val; @@ -2286,10 +2283,12 @@ static bool parseAnimateColorNode(QSvgNode *parent, QColor startColor, endColor; resolveColor(fromStr, startColor, handler); resolveColor(toStr, endColor, handler); + colors.reserve(2); colors.append(startColor); colors.append(endColor); } else { QStringList str = valuesStr.split(QLatin1Char(';')); + colors.reserve(str.count()); QStringList::const_iterator itr; for (itr = str.constBegin(); itr != str.constEnd(); ++itr) { QColor color; diff --git a/src/svg/svg.pro b/src/svg/svg.pro index 7f9c3c8..83e76b7 100644 --- a/src/svg/svg.pro +++ b/src/svg/svg.pro @@ -51,8 +51,5 @@ contains(QT_CONFIG, system-zlib) { else: LIBS += $$ZLIB_LIBS } } else { - git_build: \ - INCLUDEPATH += $$[QT_INSTALL_HEADERS/get]/QtZlib - else: \ - INCLUDEPATH += $$[QT_INSTALL_HEADERS/src]/QtZlib + QT_PRIVATE += zlib-private } diff --git a/tests/auto/qicon_svg/icons/triangle.svg b/tests/auto/qicon_svg/icons/triangle.svg new file mode 100644 index 0000000..e858490 --- /dev/null +++ b/tests/auto/qicon_svg/icons/triangle.svg @@ -0,0 +1,12 @@ +<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In --> +<svg version="1.1" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" + x="0px" y="0px" width="39.2px" height="39.2px" viewBox="0 0 39.2 39.2" style="enable-background:new 0 0 39.2 39.2;" + xml:space="preserve"> +<style type="text/css"> + .st1{fill:#1B1E23;} +</style> +<defs> +</defs> +<polygon class="st1" points="15.3,11.3 29.2,19.6 15.3,27.9 "/> +</svg> diff --git a/tests/auto/qicon_svg/tst_qicon_svg.cpp b/tests/auto/qicon_svg/tst_qicon_svg.cpp index f5b97e0..893cf99 100644 --- a/tests/auto/qicon_svg/tst_qicon_svg.cpp +++ b/tests/auto/qicon_svg/tst_qicon_svg.cpp @@ -60,6 +60,7 @@ void tst_QIcon_Svg::initTestCase() QFAIL("Can't find images directory!"); if (!QImageReader::supportedImageFormats().contains("svg")) QFAIL("SVG support is not available"); + QCOMPARE(QImageReader::imageFormat(prefix + "triangle.svg"), QByteArray("svg")); } void tst_QIcon_Svg::svgActualSize() |