forked from qt-creator/qt-creator
CorePlugin: Limit the usage of qMakePair and std::make_pair
Change-Id: Ibf96ca29d2570841955366371f1bab11198b3e67 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -55,8 +55,8 @@ std::pair<int, int> positionEntry(const QList<DocumentModel::Entry *> &list,
|
||||
const auto to_insert
|
||||
= static_cast<int>(std::distance(begin, std::lower_bound(begin, end, entry, &compare)));
|
||||
if (to_remove == to_insert)
|
||||
return std::make_pair(-1, -1);
|
||||
return std::make_pair(to_remove, to_insert);
|
||||
return {-1, -1};
|
||||
return {to_remove, to_insert};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ void CommandLocator::prepareSearch(const QString &entry)
|
||||
continue;
|
||||
QAction *action = command->action();
|
||||
if (action && action->isEnabled())
|
||||
d->commandsData.append(qMakePair(i, action->text()));
|
||||
d->commandsData.append({i, action->text()});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1125,7 +1125,7 @@ void MainWindow::addContextObject(IContext *context)
|
||||
if (m_contextWidgets.find(widget) != m_contextWidgets.end())
|
||||
return;
|
||||
|
||||
m_contextWidgets.insert(std::make_pair(widget, context));
|
||||
m_contextWidgets.insert({widget, context});
|
||||
connect(context, &QObject::destroyed, this, [this, context] { removeContextObject(context); });
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ int OutputWindow::maxCharCount() const
|
||||
void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
||||
{
|
||||
if (d->queuedOutput.isEmpty() || d->queuedOutput.last().second != format)
|
||||
d->queuedOutput << qMakePair(output, format);
|
||||
d->queuedOutput.push_back({output, format});
|
||||
else
|
||||
d->queuedOutput.last().first.append(output);
|
||||
if (!d->queueTimer.isActive())
|
||||
@@ -482,7 +482,7 @@ void OutputWindow::registerPositionOf(unsigned taskId, int linkedOutputLines, in
|
||||
const int firstLine = blocknumber - linkedOutputLines - skipLines;
|
||||
const int lastLine = firstLine + linkedOutputLines - 1;
|
||||
|
||||
d->taskPositions.insert(taskId, qMakePair(firstLine, lastLine));
|
||||
d->taskPositions.insert(taskId, {firstLine, lastLine});
|
||||
}
|
||||
|
||||
bool OutputWindow::knowsPositionOf(unsigned taskId) const
|
||||
|
||||
Reference in New Issue
Block a user