Various plugins: Limit the usage of qMakePair

Change-Id: I9113dd47fb4f9026f3a732aebbd0aee31651b727
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-09-30 11:12:51 +02:00
parent 00741a7216
commit 738803a4da
6 changed files with 12 additions and 15 deletions

View File

@@ -99,7 +99,7 @@ void ManagerPrivate::resetParser()
QHash<FilePath, QPair<QString, FilePaths>> projectData;
for (const Project *project : SessionManager::projects()) {
projectData.insert(project->projectFilePath(),
qMakePair(project->displayName(), project->files(Project::SourceFiles)));
{project->displayName(), project->files(Project::SourceFiles)});
}
QMetaObject::invokeMethod(m_parser, [this, projectData]() {
m_parser->resetData(projectData);

View File

@@ -2829,8 +2829,7 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
if (it.key().startsWith('(')) {
const QString expanded = rp.macroExpander->expand(it.value());
if (!expanded.isEmpty())
globalRegExpSourceMap.push_back(
qMakePair(QRegularExpression(it.key()), expanded));
globalRegExpSourceMap.push_back({QRegularExpression(it.key()), expanded});
}
}
if (globalRegExpSourceMap.isEmpty())

View File

@@ -305,7 +305,7 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
const QStringList remoteBranches =
GitClient::instance()->synchronousRepositoryBranches(remoteName, m_workingDir);
for (const QString &branch : remoteBranches)
m_remoteBranches.insertMulti(remoteName, qMakePair(branch, QDate()));
m_remoteBranches.insertMulti(remoteName, {branch, {}});
if (remoteBranches.isEmpty()) {
m_ui->targetBranchComboBox->setEditable(true);
m_ui->targetBranchComboBox->setToolTip(

View File

@@ -320,11 +320,11 @@ Parser::Private::NamePair Parser::Private::parseName(const char *begin, const ch
if (*current == '(') {
current++;
if ((nameShorthand = parseNameShorthand(&current, end)) == -1)
return qMakePair(qint64(-1), QString()); // error
return {qint64(-1), {}}; // error
}
skipSpace(&current, end);
return qMakePair(nameShorthand, QString::fromUtf8(QByteArray(current, end - current)));
return {nameShorthand, QString::fromUtf8(QByteArray(current, end - current))};
}
/*

View File

@@ -284,13 +284,11 @@ void ValgrindMemcheckParserTest::testMemcheckSample1()
expectedErrors << error;
}
QVector<QPair<qint64,qint64> > expectedErrorCounts;
expectedErrorCounts.push_back(QPair<qint64,qint64>(9, 2));
QVector<QPair<QString,qint64> > expectedSuppCounts;
expectedSuppCounts.push_back(qMakePair(QString("X on SUSE11 writev uninit padding"), static_cast<qint64>(12)));
expectedSuppCounts.push_back(qMakePair(QString("dl-hack3-cond-1"), static_cast<qint64>(2)));
expectedSuppCounts.push_back(qMakePair(QString("glibc-2.5.x-on-SUSE-10.2-(PPC)-2a"), static_cast<qint64>(2)));
const QVector<QPair<qint64,qint64>> expectedErrorCounts{{9, 2}};
const QVector<QPair<QString,qint64>> expectedSuppCounts{
{QString("X on SUSE11 writev uninit padding"), 12},
{QString("dl-hack3-cond-1"), 2},
{QString("glibc-2.5.x-on-SUSE-10.2-(PPC)-2a"), 2}};
Parser parser;
Recorder rec(&parser);

View File

@@ -51,12 +51,12 @@ public:
void errorCount(qint64 unique, qint64 count)
{
errorcounts.push_back(qMakePair(unique, count));
errorcounts.push_back({unique, count});
}
void suppressionCount(const QString &name, qint64 count)
{
suppcounts.push_back(qMakePair(name, count));
suppcounts.push_back({name, count});
}
};