From 9fa3cf15c8500fba5bbb861f1925160815ae2afd Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 22 Jun 2020 11:44:14 +0200 Subject: Use QList instead of QVector in gui Applied to headers only. Source file to be changed separately. Task-number: QTBUG-84469 Change-Id: Ic08a899321eaffc46b8461aaee3dbaa4d2c727a9 Reviewed-by: Laszlo Agocs --- src/gui/text/qcssparser_p.h | 56 ++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'src/gui/text/qcssparser_p.h') diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index ef5ae8c80b..f340a23cde 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -53,7 +53,7 @@ #include #include -#include +#include #include #include #include @@ -432,11 +432,10 @@ struct BorderData { }; QT_CSS_DECLARE_TYPEINFO(BorderData, Q_MOVABLE_TYPE) - // 1. StyleRule - x:hover, y:clicked > z:checked { prop1: value1; prop2: value2; } -// 2. QVector - x:hover, y:clicked z:checked -// 3. QVector - y:clicked z:checked -// 4. QVector - { prop1: value1; prop2: value2; } +// 2. QList - x:hover, y:clicked z:checked +// 3. QList - y:clicked z:checked +// 4. QList - { prop1: value1; prop2: value2; } // 5. Declaration - prop1: value1; struct Q_GUI_EXPORT Declaration @@ -446,7 +445,7 @@ struct Q_GUI_EXPORT Declaration inline DeclarationData() : propertyId(UnknownProperty), important(false), inheritable(false) {} QString property; Property propertyId; - QVector values; + QList values; QVariant parsed; bool important:1; bool inheritable:1; @@ -578,8 +577,8 @@ struct BasicSelector QString elementName; QStringList ids; - QVector pseudos; - QVector attributeSelectors; + QList pseudos; + QList attributeSelectors; Relation relationToNext; }; @@ -587,7 +586,7 @@ QT_CSS_DECLARE_TYPEINFO(BasicSelector, Q_MOVABLE_TYPE) struct Q_GUI_EXPORT Selector { - QVector basicSelectors; + QList basicSelectors; int specificity() const; quint64 pseudoClass(quint64 *negated = nullptr) const; QString pseudoElement() const; @@ -597,8 +596,8 @@ QT_CSS_DECLARE_TYPEINFO(Selector, Q_MOVABLE_TYPE) struct StyleRule { StyleRule() : order(0) { } - QVector selectors; - QVector declarations; + QList selectors; + QList declarations; int order; }; QT_CSS_DECLARE_TYPEINFO(StyleRule, Q_MOVABLE_TYPE) @@ -606,14 +605,14 @@ QT_CSS_DECLARE_TYPEINFO(StyleRule, Q_MOVABLE_TYPE) struct MediaRule { QStringList media; - QVector styleRules; + QList styleRules; }; QT_CSS_DECLARE_TYPEINFO(MediaRule, Q_MOVABLE_TYPE) struct PageRule { QString selector; - QVector declarations; + QList declarations; }; QT_CSS_DECLARE_TYPEINFO(PageRule, Q_MOVABLE_TYPE) @@ -635,10 +634,10 @@ enum StyleSheetOrigin { struct StyleSheet { StyleSheet() : origin(StyleSheetOrigin_Unspecified), depth(0) { } - QVector styleRules; //only contains rules that are not indexed - QVector mediaRules; - QVector pageRules; - QVector importRules; + QList styleRules; // only contains rules that are not indexed + QList mediaRules; + QList pageRules; + QList importRules; StyleSheetOrigin origin; int depth; // applicable only for inline style sheets QMultiHash nameIndex; @@ -660,8 +659,8 @@ public: int id; }; - QVector styleRulesForNode(NodePtr node); - QVector declarationsForNode(NodePtr node, const char *extraPseudo = nullptr); + QList styleRulesForNode(NodePtr node); + QList declarationsForNode(NodePtr node, const char *extraPseudo = nullptr); virtual bool nodeNameEquals(NodePtr node, const QString& nodeName) const; virtual QString attribute(NodePtr node, const QString &name) const = 0; @@ -674,7 +673,7 @@ public: virtual NodePtr duplicateNode(NodePtr node) const = 0; virtual void freeNode(NodePtr node) const = 0; - QVector styleSheets; + QList styleSheets; QString medium; Qt::CaseSensitivity nameCaseSensitivity; private: @@ -750,7 +749,7 @@ class Q_GUI_EXPORT Scanner { public: static QString preprocess(const QString &input, bool *hasEscapeSequences = nullptr); - static void scan(const QString &preprocessedInput, QVector *symbols); + static void scan(const QString &preprocessedInput, QList *symbols); }; class Q_GUI_EXPORT Parser @@ -780,7 +779,7 @@ public: bool parsePseudo(Pseudo *pseudo); bool parseNextDeclaration(Declaration *declaration); bool parsePrio(Declaration *declaration); - bool parseExpr(QVector *values); + bool parseExpr(QList *values); bool parseTerm(Value *value); bool parseFunction(QString *name, QString *args); bool parseHexColor(QColor *col); @@ -805,7 +804,12 @@ public: inline bool testProperty() { return test(IDENT); } bool testTerm(); inline bool testExpr() { return testTerm(); } - inline bool parseNextExpr(QVector *values) { if (!testExpr()) return recordError(); return parseExpr(values); } + inline bool parseNextExpr(QList *values) + { + if (!testExpr()) + return recordError(); + return parseExpr(values); + } bool testPrio(); inline bool testHexColor() { return test(HASH); } inline bool testFunction() { return test(FUNCTION); } @@ -833,7 +837,7 @@ public: inline bool recordError() { errorIndex = index; return false; } - QVector symbols; + QList symbols; int index; int errorIndex; bool hasEscapeSequences; @@ -842,7 +846,7 @@ public: struct Q_GUI_EXPORT ValueExtractor { - ValueExtractor(const QVector &declarations, const QPalette & = QPalette()); + ValueExtractor(const QList &declarations, const QPalette & = QPalette()); bool extractFont(QFont *font, int *fontSizeAdjustment); bool extractBackground(QBrush *, QString *, Repeat *, Qt::Alignment *, QCss::Origin *, QCss::Attachment *, @@ -868,7 +872,7 @@ private: QSize sizeValue(const Declaration &decl); void sizeValues(const Declaration &decl, QSize *radii); - QVector declarations; + QList declarations; QFont f; int adjustment; int fontExtracted; -- cgit v1.2.3