From 73bd221554db932ea19591b2eab24ee2624d4a30 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 20 Jul 2019 17:44:25 +0100 Subject: [PATCH] Use C++11-style QStringList local-initialization --- templates/defaulttags/for.cpp | 4 +-- templates/defaulttags/if.cpp | 10 +++--- templates/defaulttags/ifchanged.cpp | 4 +-- templates/defaulttags/ifequal.cpp | 3 +- templates/lib/cachingloaderdecorator.h | 2 +- templates/lib/engine.h | 2 +- templates/lib/parser.cpp | 2 +- templates/lib/templateloader.h | 18 +++++++---- templates/loadertags/block.cpp | 5 ++- templates/tests/testbuiltins.cpp | 34 +++++++++----------- templates/tests/testcachingloader.cpp | 2 +- templates/tests/testdefaulttags.cpp | 6 ++-- templates/tests/testfilters.cpp | 22 ++++++------- templates/tests/testgenericcontainers.cpp | 12 +++---- templates/tests/testgenerictypes.cpp | 32 +++++++++--------- templates/tests/testinternationalization.cpp | 3 +- templates/tests/testloadertags.cpp | 8 ++--- templates/tests/testscriptabletags.cpp | 8 ++--- 18 files changed, 84 insertions(+), 93 deletions(-) diff --git a/templates/defaulttags/for.cpp b/templates/defaulttags/for.cpp index fcd2b769..71c99d4c 100644 --- a/templates/defaulttags/for.cpp +++ b/templates/defaulttags/for.cpp @@ -68,8 +68,8 @@ Node *ForNodeFactory::getNode(const QString &tagContent, Parser *p) const auto n = new ForNode(vars, fe, reversed, p); - auto loopNodes = p->parse(n, QStringList() << QStringLiteral("empty") - << QStringLiteral("endfor")); + auto loopNodes + = p->parse(n, {QStringLiteral("empty"), QStringLiteral("endfor")}); n->setLoopList(loopNodes); NodeList emptyNodes; diff --git a/templates/defaulttags/if.cpp b/templates/defaulttags/if.cpp index b0ccfafb..2f426cdc 100644 --- a/templates/defaulttags/if.cpp +++ b/templates/defaulttags/if.cpp @@ -36,9 +36,8 @@ Node *IfNodeFactory::getNode(const QString &tagContent, Parser *p) const IfParser ip(p, expr); auto cond = ip.parse(); - auto nodelist = p->parse(n, QStringList() << QStringLiteral("elif") - << QStringLiteral("else") - << QStringLiteral("endif")); + auto nodelist = p->parse(n, {QStringLiteral("elif"), QStringLiteral("else"), + QStringLiteral("endif")}); nodelistConditions.push_back(qMakePair(cond, nodelist)); auto token = p->takeNextToken(); @@ -48,9 +47,8 @@ Node *IfNodeFactory::getNode(const QString &tagContent, Parser *p) const IfParser ep(p, expr); cond = ep.parse(); - nodelist = p->parse(n, QStringList() << QStringLiteral("elif") - << QStringLiteral("else") - << QStringLiteral("endif")); + nodelist = p->parse(n, {QStringLiteral("elif"), QStringLiteral("else"), + QStringLiteral("endif")}); nodelistConditions.push_back(qMakePair(cond, nodelist)); token = p->takeNextToken(); diff --git a/templates/defaulttags/ifchanged.cpp b/templates/defaulttags/ifchanged.cpp index c941fe13..94a6151b 100644 --- a/templates/defaulttags/ifchanged.cpp +++ b/templates/defaulttags/ifchanged.cpp @@ -33,8 +33,8 @@ Node *IfChangedNodeFactory::getNode(const QString &tagContent, Parser *p) const expr.takeAt(0); auto n = new IfChangedNode(getFilterExpressionList(expr, p), p); - auto trueList = p->parse(n, QStringList() << QStringLiteral("else") - << QStringLiteral("endifchanged")); + auto trueList + = p->parse(n, {QStringLiteral("else"), QStringLiteral("endifchanged")}); n->setTrueList(trueList); NodeList falseList; diff --git a/templates/defaulttags/ifequal.cpp b/templates/defaulttags/ifequal.cpp index 06343e64..e8649d7f 100644 --- a/templates/defaulttags/ifequal.cpp +++ b/templates/defaulttags/ifequal.cpp @@ -45,8 +45,7 @@ Node *IfEqualNodeFactory::do_getNode(const QString &tagContent, Parser *p, auto n = new IfEqualNode(val1, val2, negate, p); const QString endTag(QStringLiteral("end") + expr.first()); - auto trueList - = p->parse(n, QStringList() << QStringLiteral("else") << endTag); + auto trueList = p->parse(n, {QStringLiteral("else"), endTag}); n->setTrueList(trueList); NodeList falseList; if (p->takeNextToken().content == QStringLiteral("else")) { diff --git a/templates/lib/cachingloaderdecorator.h b/templates/lib/cachingloaderdecorator.h index 4156ff71..14716e17 100644 --- a/templates/lib/cachingloaderdecorator.h +++ b/templates/lib/cachingloaderdecorator.h @@ -41,7 +41,7 @@ class CachingLoaderDecoratorPrivate; * @code * Grantlee::FileSystemTemplateLoader::Ptr loader( new * Grantlee::FileSystemTemplateLoader() ); - * loader->setTemplateDirs( QStringList() << "/path/one" << "/path/two" ); + * loader->setTemplateDirs({"/path/one", "/path/two"}); * * Grantlee::CachingLoaderDecorator::Ptr cache( new * Grantlee::CachingLoaderDecorator( loader ) ); diff --git a/templates/lib/engine.h b/templates/lib/engine.h index ef10263c..a6714c1d 100644 --- a/templates/lib/engine.h +++ b/templates/lib/engine.h @@ -46,7 +46,7 @@ class EnginePrivate; Engine *engine = new Engine(); auto loader = QSharedPointer::create(); - loader->setTemplateDirs( QStringList() << "/usr/share/myapp/templates" ); + loader->setTemplateDirs( {"/usr/share/myapp/templates"} ); engine->addTemplateLoader( loader ); engine->addPluginPath( "/usr/lib/myapp" ); diff --git a/templates/lib/parser.cpp b/templates/lib/parser.cpp index 97096d41..d00103df 100644 --- a/templates/lib/parser.cpp +++ b/templates/lib/parser.cpp @@ -166,7 +166,7 @@ QSharedPointer Parser::getFilter(const QString &name) const NodeList Parser::parse(Node *parent, const QString &stopAt) { Q_D(Parser); - return d->parse(parent, QStringList() << stopAt); + return d->parse(parent, {stopAt}); } NodeList Parser::parse(TemplateImpl *parent, const QStringList &stopAt) diff --git a/templates/lib/templateloader.h b/templates/lib/templateloader.h index 0b9c7777..8b8d5bcc 100644 --- a/templates/lib/templateloader.h +++ b/templates/lib/templateloader.h @@ -86,8 +86,10 @@ class FileSystemTemplateLoaderPrivate; are checked in order, and the first match hit is parsed and returned. @code - loader->setTemplateDirs(QStringList() << "/home/user/app/templates" << - "/usr/local/share/app/templates" ); + loader->setTemplateDirs({ + "/home/user/app/templates", + "/usr/local/share/app/templates" + }); engine->setTemplateLoader( loader ); // This will try /home/user/app/templates/mytemplate.html @@ -99,8 +101,10 @@ class FileSystemTemplateLoaderPrivate; appended to search paths before the template name. @code - loader->setTemplateDirs(QStringList() << "/home/user/app/templates" << - "/usr/local/share/app/templates" ); + loader->setTemplateDirs({ + "/home/user/app/templates" << + "/usr/local/share/app/templates" + }); loader->setTheme( "simple_theme" ); engine->setTemplateLoader( loader ); @@ -113,8 +117,10 @@ class FileSystemTemplateLoaderPrivate; queried for templates. @code - loader->setTemplateDirs(QStringList() << "/home/user/app/templates" << - "/usr/local/share/app/templates" ); + loader->setTemplateDirs({ + "/home/user/app/templates", + "/usr/local/share/app/templates" + }); loader->setTheme( "simple_theme" ); engine->setTemplateLoader( loader ); diff --git a/templates/loadertags/block.cpp b/templates/loadertags/block.cpp index c87f7d5b..bcd668f0 100644 --- a/templates/loadertags/block.cpp +++ b/templates/loadertags/block.cpp @@ -76,9 +76,8 @@ Node *BlockNodeFactory::getNode(const QString &tagContent, Parser *p) const const auto list = p->parse(n, QStringLiteral("endblock")); auto endBlock = p->takeNextToken(); - const auto acceptableBlocks = QStringList() - << QStringLiteral("endblock") - << QStringLiteral("endblock ") + blockName; + const QStringList acceptableBlocks{QStringLiteral("endblock"), + QStringLiteral("endblock ") + blockName}; if (!acceptableBlocks.contains(endBlock.content)) { p->invalidBlockTag(endBlock, QStringLiteral("endblock"), acceptableBlocks); } diff --git a/templates/tests/testbuiltins.cpp b/templates/tests/testbuiltins.cpp index 622beb93..f05e5d3b 100644 --- a/templates/tests/testbuiltins.cpp +++ b/templates/tests/testbuiltins.cpp @@ -264,7 +264,7 @@ void TestBuiltinSyntax::testRenderAfterError() { Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); QSharedPointer loader(new InMemoryTemplateLoader); loader->setTemplate(QStringLiteral("template1"), @@ -302,7 +302,7 @@ void TestBuiltinSyntax::initTestCase() Engine *TestBuiltinSyntax::getEngine() { auto engine = new Engine(this); - engine->setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine->setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); return engine; } @@ -1164,7 +1164,7 @@ void TestBuiltinSyntax::testTemplatePathSafety() auto loader = new FileSystemTemplateLoader(); - loader->setTemplateDirs(QStringList() << QStringLiteral(".")); + loader->setTemplateDirs({QStringLiteral(".")}); QFile f(inputPath); auto opened = f.open(QFile::WriteOnly | QFile::Text); @@ -1201,7 +1201,7 @@ void TestBuiltinSyntax::testMediaPathSafety() auto loader = new FileSystemTemplateLoader(); - loader->setTemplateDirs(QStringList() << QStringLiteral(".")); + loader->setTemplateDirs({QStringLiteral(".")}); QFile f(inputPath); auto opened = f.open(QFile::WriteOnly | QFile::Text); @@ -1267,29 +1267,25 @@ void TestBuiltinSyntax::testTypeAccessorsUnordered_data() dict.insert(QStringLiteral("hash"), itemsHash); - QTest::newRow("type-accessors-hash-unordered01") << QStringLiteral( - "{% for key,value in hash.items %}{{ key }}:{{ value }};{% endfor %}") - << dict - << (QStringList() - << QStringLiteral( - "one:1;") - << QStringLiteral( - "two:2;") - << QStringLiteral( - "three:3;")) - << NoError; + QTest::newRow("type-accessors-hash-unordered01") + << QStringLiteral("{% for key,value in hash.items %}{{ key }}:{{ value " + "}};{% endfor %}") + << dict + << QStringList{QStringLiteral("one:1;"), QStringLiteral("two:2;"), + QStringLiteral("three:3;")} + << NoError; QTest::newRow("type-accessors-hash-unordered02") << QStringLiteral("{% for key in hash.keys %}{{ key }};{% endfor %}") << dict - << (QStringList() << QStringLiteral("one;") << QStringLiteral("two;") - << QStringLiteral("three;")) + << QStringList{QStringLiteral("one;"), QStringLiteral("two;"), + QStringLiteral("three;")} << NoError; QTest::newRow("type-accessors-hash-unordered03") << QStringLiteral( "{% for value in hash.values %}{{ value }};{% endfor %}") << dict - << (QStringList() << QStringLiteral("1;") << QStringLiteral("2;") - << QStringLiteral("3;")) + << QStringList{QStringLiteral("1;"), QStringLiteral("2;"), + QStringLiteral("3;")} << NoError; } diff --git a/templates/tests/testcachingloader.cpp b/templates/tests/testcachingloader.cpp index ecfb40b9..61c4d1a9 100644 --- a/templates/tests/testcachingloader.cpp +++ b/templates/tests/testcachingloader.cpp @@ -48,7 +48,7 @@ private Q_SLOTS: void TestCachingLoader::testRenderAfterError() { Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); QSharedPointer loader(new InMemoryTemplateLoader); loader->setTemplate(QStringLiteral("template1"), diff --git a/templates/tests/testdefaulttags.cpp b/templates/tests/testdefaulttags.cpp index 4e0dde09..f75e7e21 100644 --- a/templates/tests/testdefaulttags.cpp +++ b/templates/tests/testdefaulttags.cpp @@ -156,8 +156,7 @@ private Q_SLOTS: void TestDefaultTags::initTestCase() { m_engine = new Engine(this); - m_engine->setPluginPaths(QStringList() - << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + m_engine->setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); auto loader1 = QSharedPointer(new FakeTemplateLoader()); @@ -1108,8 +1107,7 @@ void TestDefaultTags::testForTag_data() QTest::newRow("for-tag03") << QStringLiteral( "{% for val in values %}({{ val }} sdfsdf,){% endfor %}") << dict << QString() << NoError; - QStringList emails; - emails << QStringLiteral("one") << QStringLiteral("two"); + QStringList emails{QStringLiteral("one"), QStringLiteral("two")}; QVariantHash obj; obj.insert(QStringLiteral("emails"), emails); dict.insert(QStringLiteral("contact"), obj); diff --git a/templates/tests/testfilters.cpp b/templates/tests/testfilters.cpp index f9a66422..899bc7ad 100644 --- a/templates/tests/testfilters.cpp +++ b/templates/tests/testfilters.cpp @@ -81,10 +81,10 @@ void TestFilters::initTestCase() auto appDirPath = QFileInfo(QCoreApplication::applicationDirPath()).absoluteDir().path(); - m_engine->setPluginPaths( - QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH) - << appDirPath + QStringLiteral("/tests/") // For testtags.qs - ); + m_engine->setPluginPaths({ + QStringLiteral(GRANTLEE_PLUGIN_PATH), + appDirPath + QStringLiteral("/tests/") // For testtags.qs + }); } void TestFilters::cleanupTestCase() { delete m_engine; } @@ -1295,9 +1295,9 @@ void TestFilters::testListFilters_data() dict.clear(); QVariantList mapList; - const auto cities = QStringList() - << QStringLiteral("London") << QStringLiteral("Berlin") - << QStringLiteral("Paris") << QStringLiteral("Dublin"); + const auto cities + = QStringList{QStringLiteral("London"), QStringLiteral("Berlin"), + QStringLiteral("Paris"), QStringLiteral("Dublin")}; Q_FOREACH (const QString &city, cities) { QVariantHash map; map.insert(QStringLiteral("city"), city); @@ -1329,12 +1329,12 @@ void TestFilters::testListFilters_data() QVariantList listList; const auto countries - = QStringList() << QStringLiteral("England") << QStringLiteral("Germany") - << QStringLiteral("France") << QStringLiteral("Ireland"); + = QStringList{QStringLiteral("England"), QStringLiteral("Germany"), + QStringLiteral("France"), QStringLiteral("Ireland")}; const auto languages - = QStringList() << QStringLiteral("English") << QStringLiteral("German") - << QStringLiteral("French") << QStringLiteral("Irish"); + = QStringList{QStringLiteral("English"), QStringLiteral("German"), + QStringLiteral("French"), QStringLiteral("Irish")}; for (auto i = 0; i < cities.size(); ++i) { listList << QVariant(QVariantList() diff --git a/templates/tests/testgenericcontainers.cpp b/templates/tests/testgenericcontainers.cpp index 0401c2a1..90d9eb31 100644 --- a/templates/tests/testgenericcontainers.cpp +++ b/templates/tests/testgenericcontainers.cpp @@ -190,16 +190,14 @@ template <> QString getAssociativeTemplate() template QStringList getResults() { - return QStringList() << QStringLiteral("3;3;") << QStringLiteral("9,") - << QStringLiteral("7,") << QStringLiteral("5,"); + return {QStringLiteral("3;3;"), QStringLiteral("9,"), QStringLiteral("7,"), + QStringLiteral("5,")}; } template <> QStringList getResults() { - return QStringList() << QStringLiteral("3;3;") - << QStringLiteral("Jan. 1, 1970,") - << QStringLiteral("Jan. 2, 1970,") - << QStringLiteral("Jan. 3, 1970,"); + return {QStringLiteral("3;3;"), QStringLiteral("Jan. 1, 1970,"), + QStringLiteral("Jan. 2, 1970,"), QStringLiteral("Jan. 3, 1970,")}; } template @@ -251,7 +249,7 @@ void testContainer(const QString &stringTemplate, { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); Grantlee::Context c; c.insert(QStringLiteral("container"), containerVariant); diff --git a/templates/tests/testgenerictypes.cpp b/templates/tests/testgenerictypes.cpp index c5c10677..383a53d4 100644 --- a/templates/tests/testgenerictypes.cpp +++ b/templates/tests/testgenerictypes.cpp @@ -134,7 +134,7 @@ void TestGenericTypes::testGenericClassType() { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); auto t1 = engine.newTemplate( QStringLiteral( @@ -200,7 +200,7 @@ template void testSequentialIteration(Grantlee::Context &c) { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); { Grantlee::Template t1 = engine.newTemplate( @@ -215,7 +215,7 @@ template void testSequentialIndexing(Grantlee::Context &c) { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); { Grantlee::Template t1 = engine.newTemplate( @@ -243,17 +243,15 @@ template struct SequentialContainerTester> { { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() - << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); Grantlee::Template t1 = engine.newTemplate( QStringLiteral( "{% for person in people %}{{ person.name }},{% endfor %}"), QStringLiteral("people_template")); auto result = t1->render(&c); - QStringList output; - output << QStringLiteral("Claire,") << QStringLiteral("Grant,") - << QStringLiteral("Alan,"); + QStringList output{QStringLiteral("Claire,"), QStringLiteral("Grant,"), + QStringLiteral("Alan,")}; Q_FOREACH (const QString &s, output) { QVERIFY(result.contains(s)); } @@ -297,7 +295,7 @@ void testAssociativeValues(Grantlee::Context &c, bool unordered = false) { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); { Grantlee::Template t1 = engine.newTemplate( @@ -322,7 +320,7 @@ void testAssociativeItems(Grantlee::Context &c, bool unordered) { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); { Grantlee::Template t1 = engine.newTemplate( @@ -346,7 +344,7 @@ void doTestAssociativeContainer_Variant(bool unordered = false) { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); Grantlee::Context c; @@ -445,7 +443,7 @@ void doTestAssociativeContainer_Type(bool unordered = false) { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); Grantlee::Context c; @@ -459,7 +457,7 @@ void doTestAssociativeContainer_Type_Number(bool unordered = false) { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); Grantlee::Context c; @@ -532,7 +530,7 @@ void TestGenericTypes::testSharedPointer() { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); auto t1 = engine.newTemplate(QStringLiteral("{{ p.name }} {{ p.age }}"), QStringLiteral("template1")); @@ -551,7 +549,7 @@ void TestGenericTypes::testThirdPartySharedPointer() #ifndef GRANTLEE_NO_TR1 Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); auto t1 = engine.newTemplate(QStringLiteral("{{ p.name }} {{ p.age }}"), QStringLiteral("template1")); @@ -610,7 +608,7 @@ void TestGenericTypes::testNestedContainers() { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); Grantlee::Context c; c.insert(QStringLiteral("stack"), QVariant::fromValue(getMapStack())); @@ -673,7 +671,7 @@ void TestGenericTypes::testCustomQObjectDerived() { Grantlee::Engine engine; - engine.setPluginPaths(QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + engine.setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); auto customObject = new CustomObject(this); customObject->setProperty("someProp", QStringLiteral("propValue")); diff --git a/templates/tests/testinternationalization.cpp b/templates/tests/testinternationalization.cpp index 989f1b1c..ba3ec659 100644 --- a/templates/tests/testinternationalization.cpp +++ b/templates/tests/testinternationalization.cpp @@ -59,8 +59,7 @@ class TestInternationalization : public CoverageObject auto cLocale = QLocale::c(); cLocale.setNumberOptions(QLocale::OmitGroupSeparator); cLocalizer.reset(new QtLocalizer(cLocale)); - m_engine->setPluginPaths(QStringList() - << QStringLiteral(GRANTLEE_PLUGIN_PATH)); + m_engine->setPluginPaths({QStringLiteral(GRANTLEE_PLUGIN_PATH)}); INIT_LOCALIZER(cLocalizer) INIT_LOCALIZER(deLocalizer) INIT_LOCALIZER(frLocalizer) diff --git a/templates/tests/testloadertags.cpp b/templates/tests/testloadertags.cpp index 7d70e5c2..9a04b629 100644 --- a/templates/tests/testloadertags.cpp +++ b/templates/tests/testloadertags.cpp @@ -73,10 +73,10 @@ void TestLoaderTags::initTestCase() auto appDirPath = QFileInfo(QCoreApplication::applicationDirPath()).absoluteDir().path(); - m_engine->setPluginPaths(QStringList() - << QStringLiteral(GRANTLEE_PLUGIN_PATH) - << QStringLiteral(":/plugins/") // For testtags.qs - ); + m_engine->setPluginPaths({ + QStringLiteral(GRANTLEE_PLUGIN_PATH), + QStringLiteral(":/plugins/") // For testtags.qs + }); #ifdef HAVE_QTQML_LIB m_engine->addDefaultLibrary(QStringLiteral("grantlee_scriptabletags")); #endif diff --git a/templates/tests/testscriptabletags.cpp b/templates/tests/testscriptabletags.cpp index 90bc0d3f..e250bed1 100644 --- a/templates/tests/testscriptabletags.cpp +++ b/templates/tests/testscriptabletags.cpp @@ -67,10 +67,10 @@ void TestScriptableTagsSyntax::initTestCase() m_engine = new Engine(this); auto appDirPath = QFileInfo(QCoreApplication::applicationDirPath()).absoluteDir().path(); - m_engine->setPluginPaths( - QStringList() << QStringLiteral(GRANTLEE_PLUGIN_PATH) - << QStringLiteral(":/plugins/") // For scripteddefaults.qs - ); + m_engine->setPluginPaths({ + QStringLiteral(GRANTLEE_PLUGIN_PATH), + QStringLiteral(":/plugins/") // For scripteddefaults.qs + }); m_engine->addDefaultLibrary(QStringLiteral("grantlee_scriptabletags")); }