From 74cf1f940c2f21c5e1dc01f8b57ddd7ea022aec1 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 8 Jun 2020 09:10:40 +0200 Subject: Use QList instead of QVector Task-number: QTBUG-84469 Change-Id: I8c3e80c77422abeb23fff747bf4ca479ff0d35b3 Reviewed-by: Lars Knoll --- src/svg/qsvggenerator.cpp | 2 +- src/svg/qsvggraphics.cpp | 6 +++--- src/svg/qsvggraphics_p.h | 2 +- src/svg/qsvghandler.cpp | 36 ++++++++++++++++++------------------ src/svg/qsvghandler_p.h | 2 +- src/svg/qsvgstyle.cpp | 10 +++++----- src/svg/qsvgstyle_p.h | 6 +++--- 7 files changed, 32 insertions(+), 32 deletions(-) (limited to 'src') 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 &pattern, qreal width, QString *pattern_string) +static void translate_dashPattern(const QList &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 paragraphs; - QVector > formatRanges(1); + QList paragraphs; + QList > 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(), bounds); + tl.draw(p, QPointF(px, py), QList(), 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 m_tspans; + QList 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 m_cssAttributes; + QList m_cssAttributes; #endif }; @@ -693,9 +693,9 @@ static qreal toDouble(const QStringRef &str, bool *ok = NULL) return res; } -static QVector parseNumbersList(const QChar *&str) +static QList parseNumbersList(const QChar *&str) { - QVector points; + QList points; if (!str) return points; points.reserve(32); @@ -742,9 +742,9 @@ static inline void parseNumbersArray(const QChar *&str, QVarLengthArray parsePercentageList(const QChar *&str) +static QList parsePercentageList(const QChar *&str) { - QVector points; + QList 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 compo = parseNumbersList(s); + QList 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 dashes = parseNumbersList(s); + QList dashes = parseNumbersList(s); // if the dash count is odd the dashes should be duplicated if ((dashes.size() & 1) != 0) - dashes << QVector(dashes); + dashes << QList(dashes); prop->setDashArray(dashes); } } @@ -1944,7 +1944,7 @@ static bool parseStyle(QSvgNode *node, #ifndef QT_NO_CSSPARSER -static void parseCSStoXMLAttrs(const QVector &declarations, +static void parseCSStoXMLAttrs(const QList &declarations, QXmlStreamAttributes &attributes) { for (int i = 0; i < declarations.count(); ++i) { @@ -1990,7 +1990,7 @@ static void parseCSStoXMLAttrs(const QVector &declarations, } } -void QSvgHandler::parseCSStoXMLAttrs(const QString &css, QVector *attributes) +void QSvgHandler::parseCSStoXMLAttrs(const QString &css, QList *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 decls = selector->declarationsForNode(cssNode); + QList decls = selector->declarationsForNode(cssNode); QXmlStreamAttributes attributes; parseCSStoXMLAttrs(decls, attributes); @@ -2417,9 +2417,9 @@ static bool parseAimateMotionNode(QSvgNode *parent, return true; } -static void parseNumberTriplet(QVector &values, const QChar *&s) +static void parseNumberTriplet(QList &values, const QChar *&s) { - QVector list = parseNumbersList(s); + QList 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 vals; + QList 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 points = parseNumbersList(s); + QList 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 points = parseNumbersList(s); + QList 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 decls = handler->selector()->declarationsForNode(cssNode); + QList 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 *attributes); + void parseCSStoXMLAttrs(const QString &css, QList *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 dashes = m_stroke.dashPattern(); + QList 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 dashes = pen.dashPattern(); + QList 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 &dashes) +void QSvgStrokeStyle::setDashArray(const QList &dashes) { if (m_strokeWidthSet) { - QVector d = dashes; + QList 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 &args) +void QSvgAnimateTransform::setArgs(TransformType type, Additive additive, const QList &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 &dashes); + void setDashArray(const QList &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 &args); + void setArgs(TransformType type, Additive additive, const QList &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 m_args; + QList m_args; int m_count; QTransform m_transform; QTransform m_oldWorldTransform; -- cgit v1.2.1