Commit 2475da1b authored by Christian Stenger's avatar Christian Stenger

Replace some more occurrences of QStringList() << pattern

Change-Id: Ic7193ac3a741763479a9ef129ed05cb7ca64f1e9
Reviewed-by: default avatarhjk <hjk@qt.io>
parent 38b6f4ff
...@@ -167,11 +167,10 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data() ...@@ -167,11 +167,10 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data()
QTest::addColumn<QList<int> >("expectedUnnamedQuickTestsCount"); QTest::addColumn<QList<int> >("expectedUnnamedQuickTestsCount");
QTest::addColumn<QList<int> >("expectedDataTagsCount"); QTest::addColumn<QList<int> >("expectedDataTagsCount");
QStringList projects = QStringList() QStringList projects = QStringList({ m_tmpDir->path() + "/plain/plain.pro",
<< QString(m_tmpDir->path() + QLatin1String("/plain/plain.pro")) m_tmpDir->path() + "/mixed_atp/mixed_atp.pro",
<< QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.pro")) m_tmpDir->path() + "/plain/plain.qbs",
<< QString(m_tmpDir->path() + QLatin1String("/plain/plain.qbs")) m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs" });
<< QString(m_tmpDir->path() + QLatin1String("/mixed_atp/mixed_atp.qbs"));
QList<int> expectedAutoTests = QList<int>() << 1 << 4 << 1 << 4; QList<int> expectedAutoTests = QList<int>() << 1 << 4 << 1 << 4;
QList<int> expectedNamedQuickTests = QList<int>() << 0 << 5 << 0 << 5; QList<int> expectedNamedQuickTests = QList<int>() << 0 << 5 << 0 << 5;
......
This diff is collapsed.
...@@ -42,34 +42,14 @@ namespace CppTools { ...@@ -42,34 +42,14 @@ namespace CppTools {
CppCompletionAssistProcessor::CppCompletionAssistProcessor(int snippetItemOrder) CppCompletionAssistProcessor::CppCompletionAssistProcessor(int snippetItemOrder)
: m_positionForProposal(-1) : m_positionForProposal(-1)
, m_preprocessorCompletions(QStringList() , m_preprocessorCompletions(
<< QLatin1String("define") QStringList({ "define", "error", "include", "line", "pragma", "pragma once",
<< QLatin1String("error") "pragma omp atomic", "pragma omp parallel", "pragma omp for",
<< QLatin1String("include") "pragma omp ordered", "pragma omp parallel for", "pragma omp section",
<< QLatin1String("line") "pragma omp sections", "pragma omp parallel sections", "pragma omp single",
<< QLatin1String("pragma") "pragma omp master", "pragma omp critical", "pragma omp barrier",
<< QLatin1String("pragma once") "pragma omp flush", "pragma omp threadprivate", "undef", "if", "ifdef",
<< QLatin1String("pragma omp atomic") "ifndef", "elif", "else", "endif" }))
<< QLatin1String("pragma omp parallel")
<< QLatin1String("pragma omp for")
<< QLatin1String("pragma omp ordered")
<< QLatin1String("pragma omp parallel for")
<< QLatin1String("pragma omp section")
<< QLatin1String("pragma omp sections")
<< QLatin1String("pragma omp parallel sections")
<< QLatin1String("pragma omp single")
<< QLatin1String("pragma omp master")
<< QLatin1String("pragma omp critical")
<< QLatin1String("pragma omp barrier")
<< QLatin1String("pragma omp flush")
<< QLatin1String("pragma omp threadprivate")
<< QLatin1String("undef")
<< QLatin1String("if")
<< QLatin1String("ifdef")
<< QLatin1String("ifndef")
<< QLatin1String("elif")
<< QLatin1String("else")
<< QLatin1String("endif"))
, m_hintProposal(0) , m_hintProposal(0)
, m_snippetCollector(QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID), , m_snippetCollector(QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID),
QIcon(QLatin1String(":/texteditor/images/snippet.png")), QIcon(QLatin1String(":/texteditor/images/snippet.png")),
......
...@@ -87,15 +87,12 @@ void CppFileSettings::toSettings(QSettings *s) const ...@@ -87,15 +87,12 @@ void CppFileSettings::toSettings(QSettings *s) const
void CppFileSettings::fromSettings(QSettings *s) void CppFileSettings::fromSettings(QSettings *s)
{ {
const QStringList defaultHeaderSearchPaths = QStringList() const QStringList defaultHeaderSearchPaths
<< QLatin1String("include") = QStringList({ "include", "Include", QDir::toNativeSeparators("../include"),
<< QLatin1String("Include") QDir::toNativeSeparators("../Include") });
<< QDir::toNativeSeparators(QLatin1String("../include")) const QStringList defaultSourceSearchPaths
<< QDir::toNativeSeparators(QLatin1String("../Include")); = QStringList({ QDir::toNativeSeparators("../src"), QDir::toNativeSeparators("../Src"),
const QStringList defaultSourceSearchPaths = QStringList() ".." });
<< QDir::toNativeSeparators(QLatin1String("../src"))
<< QDir::toNativeSeparators(QLatin1String("../Src"))
<< QLatin1String("..");
s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP)); s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP));
headerPrefixes = s->value(QLatin1String(headerPrefixesKeyC)).toStringList(); headerPrefixes = s->value(QLatin1String(headerPrefixesKeyC)).toStringList();
sourcePrefixes = s->value(QLatin1String(sourcePrefixesKeyC)).toStringList(); sourcePrefixes = s->value(QLatin1String(sourcePrefixesKeyC)).toStringList();
......
...@@ -48,10 +48,10 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::IRunConfigurat ...@@ -48,10 +48,10 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::IRunConfigurat
globalSettingLayout->setContentsMargins(0, 0, 0, 0); globalSettingLayout->setContentsMargins(0, 0, 0, 0);
m_settingsCombo = new QComboBox(globalSetting); m_settingsCombo = new QComboBox(globalSetting);
m_settingsCombo->addItems(QStringList() m_settingsCombo->addItems(QStringList({
<< QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Global") QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Global"),
<< QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Custom") QApplication::translate("ProjectExplorer::Internal::EditorSettingsPropertiesPage", "Custom")
); }));
globalSettingLayout->addWidget(m_settingsCombo); globalSettingLayout->addWidget(m_settingsCombo);
connect(m_settingsCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), connect(m_settingsCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, &AnalyzerRunConfigWidget::chooseSettings); this, &AnalyzerRunConfigWidget::chooseSettings);
......
...@@ -902,9 +902,8 @@ BreakHandler::BreakHandler() ...@@ -902,9 +902,8 @@ BreakHandler::BreakHandler()
#if USE_BREAK_MODEL_TEST #if USE_BREAK_MODEL_TEST
new ModelTest(this, 0); new ModelTest(this, 0);
#endif #endif
setHeader(QStringList() setHeader(QStringList({ tr("Number"), tr("Function"), tr("File"), tr("Line"), tr("Address"),
<< tr("Number") << tr("Function") << tr("File") << tr("Line") tr("Condition"), tr("Ignore"), tr("Threads") }));
<< tr("Address") << tr("Condition") << tr("Ignore") << tr("Threads"));
} }
static inline bool fileNameMatch(const QString &f1, const QString &f2) static inline bool fileNameMatch(const QString &f1, const QString &f2)
......
...@@ -214,9 +214,8 @@ public: ...@@ -214,9 +214,8 @@ public:
// Since no project is opened and the ui_*.h is not generated, // Since no project is opened and the ui_*.h is not generated,
// the following diagnostic messages will be ignored. // the following diagnostic messages will be ignored.
const QStringList ignoreList = QStringList() const QStringList ignoreList = QStringList({ "ui_form.h: No such file or directory",
<< QLatin1String("ui_form.h: No such file or directory") "QWidget: No such file or directory" });
<< QLatin1String("QWidget: No such file or directory");
QList<Document::DiagnosticMessage> cleanedDiagnosticMessages; QList<Document::DiagnosticMessage> cleanedDiagnosticMessages;
foreach (const Document::DiagnosticMessage &message, document->diagnosticMessages()) { foreach (const Document::DiagnosticMessage &message, document->diagnosticMessages()) {
if (!ignoreList.contains(message.text())) if (!ignoreList.contains(message.text()))
...@@ -247,10 +246,9 @@ void FormEditorPlugin::test_gotoslot_data() ...@@ -247,10 +246,9 @@ void FormEditorPlugin::test_gotoslot_data()
MyTestDataDir testDataDirWithoutProject(_("gotoslot_withoutProject")); MyTestDataDir testDataDirWithoutProject(_("gotoslot_withoutProject"));
QTest::newRow("withoutProject") QTest::newRow("withoutProject")
<< (QStringList() << QStringList({ testDataDirWithoutProject.file(_("form.cpp")),
<< testDataDirWithoutProject.file(_("form.cpp")) testDataDirWithoutProject.file(_("form.h")),
<< testDataDirWithoutProject.file(_("form.h")) testDataDirWithoutProject.file(_("form.ui")) });
<< testDataDirWithoutProject.file(_("form.ui")));
// Finding the right class for inserting definitions/declarations is based on // Finding the right class for inserting definitions/declarations is based on
// finding a class with a member whose type is the class from the "ui_xxx.h" header. // finding a class with a member whose type is the class from the "ui_xxx.h" header.
...@@ -261,24 +259,18 @@ void FormEditorPlugin::test_gotoslot_data() ...@@ -261,24 +259,18 @@ void FormEditorPlugin::test_gotoslot_data()
testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_pointer")); testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_pointer"));
QTest::newRow("insertIntoCorrectClass_pointer") QTest::newRow("insertIntoCorrectClass_pointer")
<< (QStringList() << QStringList({ testDataDir.file(_("form.cpp")), testDataDir.file(_("form.h")),
<< testDataDir.file(_("form.cpp")) testDataDirWithoutProject.file(_("form.ui")) }); // reuse
<< testDataDir.file(_("form.h"))
<< testDataDirWithoutProject.file(_("form.ui"))); // reuse
testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_non-pointer")); testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_non-pointer"));
QTest::newRow("insertIntoCorrectClass_non-pointer") QTest::newRow("insertIntoCorrectClass_non-pointer")
<< (QStringList() << QStringList({ testDataDir.file(_("form.cpp")), testDataDir.file(_("form.h")),
<< testDataDir.file(_("form.cpp")) testDataDirWithoutProject.file(_("form.ui")) }); // reuse
<< testDataDir.file(_("form.h"))
<< testDataDirWithoutProject.file(_("form.ui"))); // reuse
testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_pointer_ns_using")); testDataDir = MyTestDataDir(_("gotoslot_insertIntoCorrectClass_pointer_ns_using"));
QTest::newRow("insertIntoCorrectClass_pointer_ns_using") QTest::newRow("insertIntoCorrectClass_pointer_ns_using")
<< (QStringList() << QStringList({ testDataDir.file(_("form.cpp")), testDataDir.file(_("form.h")),
<< testDataDir.file(_("form.cpp")) testDataDir.file(_("form.ui")) });
<< testDataDir.file(_("form.h"))
<< testDataDir.file(_("form.ui")));
} }
} // namespace Internal } // namespace Internal
......
...@@ -353,19 +353,9 @@ static QString addConstRefIfNeeded(const QString &argument) ...@@ -353,19 +353,9 @@ static QString addConstRefIfNeeded(const QString &argument)
return argument; return argument;
// for those types we don't want to add "const &" // for those types we don't want to add "const &"
static const QStringList nonConstRefs = QStringList() static const QStringList nonConstRefs = QStringList({ "bool", "int", "uint", "float", "double",
<< QLatin1String("bool") "long", "short", "char", "signed",
<< QLatin1String("int") "unsigned", "qint64", "quint64" });
<< QLatin1String("uint")
<< QLatin1String("float")
<< QLatin1String("double")
<< QLatin1String("long")
<< QLatin1String("short")
<< QLatin1String("char")
<< QLatin1String("signed")
<< QLatin1String("unsigned")
<< QLatin1String("qint64")
<< QLatin1String("quint64");
for (int i = 0; i < nonConstRefs.count(); i++) { for (int i = 0; i < nonConstRefs.count(); i++) {
const QString nonConstRef = nonConstRefs.at(i); const QString nonConstRef = nonConstRefs.at(i);
......
...@@ -387,14 +387,11 @@ QStringList IosDsymBuildStep::defaultCleanCmdList() const ...@@ -387,14 +387,11 @@ QStringList IosDsymBuildStep::defaultCleanCmdList() const
{ {
IosRunConfiguration *runConf = IosRunConfiguration *runConf =
qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration()); qobject_cast<IosRunConfiguration *>(target()->activeRunConfiguration());
QTC_ASSERT(runConf, return QStringList(QLatin1String("echo"))); QTC_ASSERT(runConf, return QStringList("echo"));
QString dsymPath = runConf->bundleDirectory().toUserOutput(); QString dsymPath = runConf->bundleDirectory().toUserOutput();
dsymPath.chop(4); dsymPath.chop(4);
dsymPath.append(QLatin1String(".dSYM")); dsymPath.append(QLatin1String(".dSYM"));
return QStringList() return QStringList({ "rm", "-rf", dsymPath });
<< QLatin1String("rm")
<< QLatin1String("-rf")
<< dsymPath;
} }
QStringList IosDsymBuildStep::defaultCmdList() const QStringList IosDsymBuildStep::defaultCmdList() const
...@@ -410,11 +407,7 @@ QStringList IosDsymBuildStep::defaultCmdList() const ...@@ -410,11 +407,7 @@ QStringList IosDsymBuildStep::defaultCmdList() const
QString dsymPath = runConf->bundleDirectory().toUserOutput(); QString dsymPath = runConf->bundleDirectory().toUserOutput();
dsymPath.chop(4); dsymPath.chop(4);
dsymPath.append(QLatin1String(".dSYM")); dsymPath.append(QLatin1String(".dSYM"));
return QStringList() return QStringList({ dsymutilCmd, "-o", dsymPath, runConf->localExecutable().toUserOutput() });
<< dsymutilCmd
<< QLatin1String("-o")
<< dsymPath
<< runConf->localExecutable().toUserOutput();
} }
......
...@@ -418,7 +418,7 @@ static FileNameList gatherQmakePathsFromQtChooser() ...@@ -418,7 +418,7 @@ static FileNameList gatherQmakePathsFromQtChooser()
if (qtchooser.isEmpty()) if (qtchooser.isEmpty())
return FileNameList(); return FileNameList();
QList<QByteArray> versions = runQtChooser(qtchooser, QStringList() << QStringLiteral("-l")); QList<QByteArray> versions = runQtChooser(qtchooser, QStringList("-l"));
QSet<FileName> foundQMakes; QSet<FileName> foundQMakes;
foreach (const QByteArray &version, versions) { foreach (const QByteArray &version, versions) {
FileName possibleQMake = FileName::fromString( FileName possibleQMake = FileName::fromString(
...@@ -475,12 +475,12 @@ static void updateDocumentation() ...@@ -475,12 +475,12 @@ static void updateDocumentation()
{ {
QStringList files; QStringList files;
foreach (BaseQtVersion *v, m_versions) { foreach (BaseQtVersion *v, m_versions) {
const QStringList docPaths = QStringList() << v->documentationPath() + QLatin1Char('/') const QStringList docPaths = QStringList({ v->documentationPath() + QChar('/'),
<< v->documentationPath() + QLatin1String("/qch/"); v->documentationPath() + "/qch/" });
foreach (const QString &docPath, docPaths) { foreach (const QString &docPath, docPaths) {
const QDir versionHelpDir(docPath); const QDir versionHelpDir(docPath);
foreach (const QString &helpFile, foreach (const QString &helpFile,
versionHelpDir.entryList(QStringList() << QLatin1String("*.qch"), QDir::Files)) versionHelpDir.entryList(QStringList("*.qch"), QDir::Files))
files << docPath + helpFile; files << docPath + helpFile;
} }
} }
......
...@@ -362,8 +362,7 @@ private: ...@@ -362,8 +362,7 @@ private:
static void createImageFromDot(const QString &inputFile, const QString &outputFile, bool verbose) static void createImageFromDot(const QString &inputFile, const QString &outputFile, bool verbose)
{ {
const QString command = CplusplusToolsUtils::portableExecutableName(QLatin1String("dot")); const QString command = CplusplusToolsUtils::portableExecutableName(QLatin1String("dot"));
const QStringList arguments = QStringList() const QStringList arguments = QStringList({ "-Tpng", "-o", outputFile, inputFile });
<< QLatin1String("-Tpng") << QLatin1String("-o") << outputFile << inputFile;
CplusplusToolsUtils::executeCommand(command, arguments, QString(), verbose); CplusplusToolsUtils::executeCommand(command, arguments, QString(), verbose);
} }
......
...@@ -65,12 +65,11 @@ BacktraceCollector::~BacktraceCollector() ...@@ -65,12 +65,11 @@ BacktraceCollector::~BacktraceCollector()
void BacktraceCollector::run(Q_PID pid) void BacktraceCollector::run(Q_PID pid)
{ {
d->debugger.start(QLatin1String("gdb"), QStringList() d->debugger.start(QLatin1String("gdb"), QStringList({
<< QLatin1String("--nw") // Do not use a window interface. "--nw", // Do not use a window interface.
<< QLatin1String("--nx") // Do not read .gdbinit file. "--nx", // Do not read .gdbinit file.
<< QLatin1String("--batch") // Exit after processing options. "--batch", // Exit after processing options.
<< QLatin1String("--command") << createTemporaryCommandFile() "--command", createTemporaryCommandFile(), "--pid", QString::number(pid) })
<< QLatin1String("--pid") << QString::number(pid)
); );
} }
......
...@@ -302,11 +302,7 @@ void CrashHandler::debugApplication() ...@@ -302,11 +302,7 @@ void CrashHandler::debugApplication()
QString executable = d->creatorInPath.toString(); QString executable = d->creatorInPath.toString();
if (executable.isEmpty() && !d->restartAppCommandLine.isEmpty()) if (executable.isEmpty() && !d->restartAppCommandLine.isEmpty())
executable = d->restartAppCommandLine.at(0); executable = d->restartAppCommandLine.at(0);
const QStringList commandLine = QStringList() const QStringList commandLine = QStringList({ executable, "-debug", QString::number(d->pid) });
<< executable
<< QLatin1String("-debug")
<< QString::number(d->pid);
QStringList environment; QStringList environment;
if (!d->restartAppEnvironment.isEmpty()) if (!d->restartAppEnvironment.isEmpty())
environment = d->restartAppEnvironment; environment = d->restartAppEnvironment;
......
...@@ -162,18 +162,10 @@ void tst_QrcParser::simpleTest() ...@@ -162,18 +162,10 @@ void tst_QrcParser::simpleTest()
QrcParser::Ptr p = QrcParser::parseQrcFile(QString::fromLatin1(TESTSRCDIR).append(QLatin1String("/simple.qrc")), QString()); QrcParser::Ptr p = QrcParser::parseQrcFile(QString::fromLatin1(TESTSRCDIR).append(QLatin1String("/simple.qrc")), QString());
QStringList paths = allPaths(p); QStringList paths = allPaths(p);
paths.sort(); paths.sort();
QVERIFY(paths == QStringList() QVERIFY(paths == QStringList({ "/", "/cut.jpg", "/images/", "/images/copy.png",
<< QLatin1String("/") "/images/cut.png", "/images/new.png", "/images/open.png",
<< QLatin1String("/cut.jpg") "/images/paste.png", "/images/save.png", "/myresources/",
<< QLatin1String("/images/") "/myresources/cut-img.png" }));
<< QLatin1String("/images/copy.png")
<< QLatin1String("/images/cut.png")
<< QLatin1String("/images/new.png")
<< QLatin1String("/images/open.png")
<< QLatin1String("/images/paste.png")
<< QLatin1String("/images/save.png")
<< QLatin1String("/myresources/")
<< QLatin1String("/myresources/cut-img.png"));
QString frPath = p->firstFileAtPath(QLatin1String("/cut.jpg"), QLocale(QLatin1String("fr_FR"))); QString frPath = p->firstFileAtPath(QLatin1String("/cut.jpg"), QLocale(QLatin1String("fr_FR")));
QString refFrPath = QString::fromLatin1(TESTSRCDIR).append(QLatin1String("/cut_fr.jpg")); QString refFrPath = QString::fromLatin1(TESTSRCDIR).append(QLatin1String("/cut_fr.jpg"));
QCOMPARE(frPath, refFrPath); QCOMPARE(frPath, refFrPath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment