diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-08 09:10:40 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-06-08 10:34:08 +0200 |
commit | 74cf1f940c2f21c5e1dc01f8b57ddd7ea022aec1 (patch) | |
tree | dea3ba7685f9850d77cd347fd84426f267e2b87c | |
parent | fd4d19bf8f878f18d0705530e73722981906f22a (diff) | |
download | qtsvg-74cf1f940c2f21c5e1dc01f8b57ddd7ea022aec1.tar.gz |
Use QList instead of QVector
Task-number: QTBUG-84469
Change-Id: I8c3e80c77422abeb23fff747bf4ca479ff0d35b3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | examples/svg/embedded/fluidlauncher/pictureflow.cpp | 12 | ||||
-rw-r--r-- | src/svg/qsvggenerator.cpp | 2 | ||||
-rw-r--r-- | src/svg/qsvggraphics.cpp | 6 | ||||
-rw-r--r-- | src/svg/qsvggraphics_p.h | 2 | ||||
-rw-r--r-- | src/svg/qsvghandler.cpp | 36 | ||||
-rw-r--r-- | src/svg/qsvghandler_p.h | 2 | ||||
-rw-r--r-- | src/svg/qsvgstyle.cpp | 10 | ||||
-rw-r--r-- | src/svg/qsvgstyle_p.h | 6 | ||||
-rw-r--r-- | tests/auto/qsvgplugin/tst_qsvgplugin.cpp | 1 |
9 files changed, 38 insertions, 39 deletions
diff --git a/examples/svg/embedded/fluidlauncher/pictureflow.cpp b/examples/svg/embedded/fluidlauncher/pictureflow.cpp index b0657a2..93b83d6 100644 --- a/examples/svg/embedded/fluidlauncher/pictureflow.cpp +++ b/examples/svg/embedded/fluidlauncher/pictureflow.cpp @@ -83,7 +83,7 @@ #include <QPainter> #include <QPixmap> #include <QTimer> -#include <QVector> +#include <QList> #include <QWidget> #include <QElapsedTimer> @@ -380,7 +380,7 @@ public: int pixelDistanceMoved; int pixelsToMovePerSlide; - QVector<QString> captions; + QList<QString> captions; private: PictureFlow* widget; @@ -389,13 +389,13 @@ private: int slideHeight; int zoom; - QVector<QImage> slideImages; + QList<QImage> slideImages; int centerIndex; SlideInfo centerSlide; - QVector<SlideInfo> leftSlides; - QVector<SlideInfo> rightSlides; + QList<SlideInfo> leftSlides; + QList<SlideInfo> rightSlides; - QVector<PFreal> rays; + QList<PFreal> rays; int itilt; int spacing; PFreal offsetX; diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index 4351171..2a56e8a 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -72,7 +72,7 @@ static void translate_color(const QColor &color, QString *color_string, *opacity_string = QString::number(color.alphaF()); } -static void translate_dashPattern(const QVector<qreal> &pattern, qreal width, QString *pattern_string) +static void translate_dashPattern(const QList<qreal> &pattern, qreal width, QString *pattern_string) { Q_ASSERT(pattern_string); diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index 20a03ff..65b9304 100644 --- a/src/svg/qsvggraphics.cpp +++ b/src/svg/qsvggraphics.cpp @@ -319,8 +319,8 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) bounds = QRectF(0, py, 1, scaledSize.height()); // x and width are not used. bool appendSpace = false; - QVector<QString> paragraphs; - QVector<QVector<QTextLayout::FormatRange> > formatRanges(1); + QList<QString> paragraphs; + QList<QList<QTextLayout::FormatRange> > formatRanges(1); paragraphs.push_back(QString()); for (int i = 0; i < m_tspans.size(); ++i) { @@ -442,7 +442,7 @@ void QSvgText::draw(QPainter *p, QSvgExtraStates &states) y += 1.1 * line.height(); } - tl.draw(p, QPointF(px, py), QVector<QTextLayout::FormatRange>(), bounds); + tl.draw(p, QPointF(px, py), QList<QTextLayout::FormatRange>(), bounds); if (endOfBoundsReached) break; diff --git a/src/svg/qsvggraphics_p.h b/src/svg/qsvggraphics_p.h index 8488b33..d2af6d6 100644 --- a/src/svg/qsvggraphics_p.h +++ b/src/svg/qsvggraphics_p.h @@ -204,7 +204,7 @@ private: // 'm_tspans' is also used to store characters outside tspans and line breaks. // If a 'm_tspan' item is null, it indicates a line break. - QVector<QSvgTspan *> m_tspans; + QList<QSvgTspan *> m_tspans; Type m_type; QSizeF m_size; diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 0d2e28e..4ba9fcc 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -52,7 +52,7 @@ #include "qbrush.h" #include "qcolor.h" #include "qtextformat.h" -#include "qvector.h" +#include "qlist.h" #include "qfileinfo.h" #include "qfile.h" #include "qdir.h" @@ -220,7 +220,7 @@ struct QSvgAttributes QStringRef stopOpacity; #ifndef QT_NO_CSSPARSER - QVector<QSvgCssAttribute> m_cssAttributes; + QList<QSvgCssAttribute> m_cssAttributes; #endif }; @@ -693,9 +693,9 @@ static qreal toDouble(const QStringRef &str, bool *ok = NULL) return res; } -static QVector<qreal> parseNumbersList(const QChar *&str) +static QList<qreal> parseNumbersList(const QChar *&str) { - QVector<qreal> points; + QList<qreal> points; if (!str) return points; points.reserve(32); @@ -742,9 +742,9 @@ static inline void parseNumbersArray(const QChar *&str, QVarLengthArray<qreal, 8 } } -static QVector<qreal> parsePercentageList(const QChar *&str) +static QList<qreal> parsePercentageList(const QChar *&str) { - QVector<qreal> points; + QList<qreal> points; if (!str) return points; @@ -855,7 +855,7 @@ static bool resolveColor(const QStringRef &colorStr, QColor &color, QSvgHandler if (colorStrTr.length() >= 7 && colorStrTr.at(colorStrTr.length() - 1) == QLatin1Char(')') && QStringRef(colorStrTr.string(), colorStrTr.position(), 4) == QLatin1String("rgb(")) { const QChar *s = colorStrTr.constData() + 4; - QVector<qreal> compo = parseNumbersList(s); + QList<qreal> compo = parseNumbersList(s); //1 means that it failed after reaching non-parsable //character which is going to be "%" if (compo.size() == 1) { @@ -1250,10 +1250,10 @@ static void parsePen(QSvgNode *node, } else { QString dashArray = attributes.strokeDashArray.toString(); const QChar *s = dashArray.constData(); - QVector<qreal> dashes = parseNumbersList(s); + QList<qreal> dashes = parseNumbersList(s); // if the dash count is odd the dashes should be duplicated if ((dashes.size() & 1) != 0) - dashes << QVector<qreal>(dashes); + dashes << QList<qreal>(dashes); prop->setDashArray(dashes); } } @@ -1944,7 +1944,7 @@ static bool parseStyle(QSvgNode *node, #ifndef QT_NO_CSSPARSER -static void parseCSStoXMLAttrs(const QVector<QCss::Declaration> &declarations, +static void parseCSStoXMLAttrs(const QList<QCss::Declaration> &declarations, QXmlStreamAttributes &attributes) { for (int i = 0; i < declarations.count(); ++i) { @@ -1990,7 +1990,7 @@ static void parseCSStoXMLAttrs(const QVector<QCss::Declaration> &declarations, } } -void QSvgHandler::parseCSStoXMLAttrs(const QString &css, QVector<QSvgCssAttribute> *attributes) +void QSvgHandler::parseCSStoXMLAttrs(const QString &css, QList<QSvgCssAttribute> *attributes) { // preprocess (for unicode escapes), tokenize and remove comments m_cssParser.init(css); @@ -2068,7 +2068,7 @@ static void cssStyleLookup(QSvgNode *node, { QCss::StyleSelector::NodePtr cssNode; cssNode.ptr = node; - QVector<QCss::Declaration> decls = selector->declarationsForNode(cssNode); + QList<QCss::Declaration> decls = selector->declarationsForNode(cssNode); QXmlStreamAttributes attributes; parseCSStoXMLAttrs(decls, attributes); @@ -2417,9 +2417,9 @@ static bool parseAimateMotionNode(QSvgNode *parent, return true; } -static void parseNumberTriplet(QVector<qreal> &values, const QChar *&s) +static void parseNumberTriplet(QList<qreal> &values, const QChar *&s) { - QVector<qreal> list = parseNumbersList(s); + QList<qreal> list = parseNumbersList(s); values << list; for (int i = 3 - list.size(); i > 0; --i) values.append(0.0); @@ -2444,7 +2444,7 @@ static bool parseAnimateTransformNode(QSvgNode *parent, if (addtv == QLatin1String("sum")) additive = QSvgAnimateTransform::Sum; - QVector<qreal> vals; + QList<qreal> vals; if (values.isEmpty()) { const QChar *s; if (fromStr.isEmpty()) { @@ -2982,7 +2982,7 @@ static QSvgNode *createPolygonNode(QSvgNode *parent, //same QPolygon parsing is in createPolylineNode const QChar *s = pointsStr.constData(); - QVector<qreal> points = parseNumbersList(s); + QList<qreal> points = parseNumbersList(s); QPolygonF poly(points.count()/2); for (int i = 0; i < poly.size(); ++i) poly[i] = QPointF(points.at(2 * i), points.at(2 * i + 1)); @@ -2998,7 +2998,7 @@ static QSvgNode *createPolylineNode(QSvgNode *parent, //same QPolygon parsing is in createPolygonNode const QChar *s = pointsStr.constData(); - QVector<qreal> points = parseNumbersList(s); + QList<qreal> points = parseNumbersList(s); QPolygonF poly(points.count()/2); for (int i = 0; i < poly.size(); ++i) poly[i] = QPointF(points.at(2 * i), points.at(2 * i + 1)); @@ -3155,7 +3155,7 @@ static bool parseStopNode(QSvgStyleProperty *parent, #ifndef QT_NO_CSSPARSER QCss::StyleSelector::NodePtr cssNode; cssNode.ptr = &anim; - QVector<QCss::Declaration> decls = handler->selector()->declarationsForNode(cssNode); + QList<QCss::Declaration> decls = handler->selector()->declarationsForNode(cssNode); for (int i = 0; i < decls.count(); ++i) { const QCss::Declaration &decl = decls.at(i); diff --git a/src/svg/qsvghandler_p.h b/src/svg/qsvghandler_p.h index d76e56c..461e48f 100644 --- a/src/svg/qsvghandler_p.h +++ b/src/svg/qsvghandler_p.h @@ -128,7 +128,7 @@ public: int animationDuration() const; #ifndef QT_NO_CSSPARSER - void parseCSStoXMLAttrs(const QString &css, QVector<QSvgCssAttribute> *attributes); + void parseCSStoXMLAttrs(const QString &css, QList<QSvgCssAttribute> *attributes); #endif inline QPen defaultPen() const diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp index 924cca0..f36dda8 100644 --- a/src/svg/qsvgstyle.cpp +++ b/src/svg/qsvgstyle.cpp @@ -336,7 +336,7 @@ void QSvgStrokeStyle::apply(QPainter *p, const QSvgNode *, QSvgExtraStates &stat setDashOffsetNeeded = true; } else { // If dash array was set, but not the width, the dash array has to be scaled with respect to the old width. - QVector<qreal> dashes = m_stroke.dashPattern(); + QList<qreal> dashes = m_stroke.dashPattern(); for (int i = 0; i < dashes.size(); ++i) dashes[i] /= oldWidth; pen.setDashPattern(dashes); @@ -344,7 +344,7 @@ void QSvgStrokeStyle::apply(QPainter *p, const QSvgNode *, QSvgExtraStates &stat } } else if (m_strokeWidthSet && pen.style() != Qt::SolidLine && scale != 1) { // If the width was set, but not the dash array, the old dash array must be scaled with respect to the new width. - QVector<qreal> dashes = pen.dashPattern(); + QList<qreal> dashes = pen.dashPattern(); for (int i = 0; i < dashes.size(); ++i) dashes[i] *= scale; pen.setDashPattern(dashes); @@ -381,10 +381,10 @@ void QSvgStrokeStyle::revert(QPainter *p, QSvgExtraStates &states) states.vectorEffect = m_oldVectorEffect; } -void QSvgStrokeStyle::setDashArray(const QVector<qreal> &dashes) +void QSvgStrokeStyle::setDashArray(const QList<qreal> &dashes) { if (m_strokeWidthSet) { - QVector<qreal> d = dashes; + QList<qreal> d = dashes; qreal w = m_stroke.widthF(); if (w != 0 && w != 1) { for (int i = 0; i < d.size(); ++i) @@ -648,7 +648,7 @@ QSvgAnimateTransform::QSvgAnimateTransform(int startMs, int endMs, int byMs ) Q_UNUSED(byMs); } -void QSvgAnimateTransform::setArgs(TransformType type, Additive additive, const QVector<qreal> &args) +void QSvgAnimateTransform::setArgs(TransformType type, Additive additive, const QList<qreal> &args) { m_type = type; m_args = args; diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h index 41d0e11..da36a20 100644 --- a/src/svg/qsvgstyle_p.h +++ b/src/svg/qsvgstyle_p.h @@ -425,7 +425,7 @@ public: m_strokeSet = 1; } - void setDashArray(const QVector<qreal> &dashes); + void setDashArray(const QList<qreal> &dashes); void setDashArrayNone() { @@ -650,7 +650,7 @@ public: }; public: QSvgAnimateTransform(int startMs, int endMs, int by = 0); - void setArgs(TransformType type, Additive additive, const QVector<qreal> &args); + void setArgs(TransformType type, Additive additive, const QList<qreal> &args); void setFreeze(bool freeze); void setRepeatCount(qreal repeatCount); void apply(QPainter *p, const QSvgNode *node, QSvgExtraStates &states) override; @@ -693,7 +693,7 @@ private: qreal m_totalRunningTime; TransformType m_type; Additive m_additive; - QVector<qreal> m_args; + QList<qreal> m_args; int m_count; QTransform m_transform; QTransform m_oldWorldTransform; diff --git a/tests/auto/qsvgplugin/tst_qsvgplugin.cpp b/tests/auto/qsvgplugin/tst_qsvgplugin.cpp index e1f84f3..95f37eb 100644 --- a/tests/auto/qsvgplugin/tst_qsvgplugin.cpp +++ b/tests/auto/qsvgplugin/tst_qsvgplugin.cpp @@ -32,7 +32,6 @@ #include "../../../src/plugins/imageformats/svg/qsvgiohandler.cpp" #include <QImage> #include <QStringList> -#include <QVector> #ifndef SRCDIR #define SRCDIR |