Commit 47886969 authored by Ulf Hermann's avatar Ulf Hermann

Drop unused variables and lambda captures

Also, add context to connect() expressions where we are or were
capturing "this".

Change-Id: I6e006ba6f83d532478018550d148ee93eca59605
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
Reviewed-by: default avatarhjk <hjk@qt.io>
parent e3ae6285
......@@ -397,7 +397,7 @@ void QmlDebugConnection::newConnection()
connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected);
connect(socket, static_cast<void (QLocalSocket::*)(QLocalSocket::LocalSocketError)>
(&QLocalSocket::error), this, [this, d](QLocalSocket::LocalSocketError error) {
(&QLocalSocket::error), this, [this](QLocalSocket::LocalSocketError error) {
emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error)));
socketDisconnected();
});
......
......@@ -57,7 +57,7 @@ void SshAgent::refreshKeysImpl()
if (state() != Connected)
return;
const auto keysRequestIt = std::find_if(m_pendingRequests.constBegin(),
m_pendingRequests.constEnd(), [this](const Request &r) { return r.isKeysRequest(); });
m_pendingRequests.constEnd(), [](const Request &r) { return r.isKeysRequest(); });
if (keysRequestIt != m_pendingRequests.constEnd()) {
qCDebug(sshLog) << "keys request already pending, not adding another one";
return;
......
......@@ -42,7 +42,7 @@ AndroidQmlProfilerSupport::AndroidQmlProfilerSupport(RunControl *runControl)
auto profiler = runControl->createWorker(runControl->runMode());
profiler->addStartDependency(this);
connect(runner, &AndroidRunner::qmlServerReady, [this, runner, profiler](const QUrl &server) {
connect(runner, &AndroidRunner::qmlServerReady, this, [this, profiler](const QUrl &server) {
profiler->recordData("QmlServerUrl", server);
reportStarted();
});
......
......@@ -116,7 +116,7 @@ void AutotestPlugin::initializeMenuEntries()
action = new QAction(tr("Re&scan Tests"), this);
command = ActionManager::registerAction(action, Constants::ACTION_SCAN_ID);
command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+S")));
connect(action, &QAction::triggered, [this] () {
connect(action, &QAction::triggered, this, [] () {
TestTreeModel::instance()->parser()->updateTestTree();
});
menu->addAction(command);
......
......@@ -402,7 +402,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList, ITestParser *pars
parser->init(list);
QFuture<TestParseResultPtr> future = Utils::map(list,
[this, codeParsers](QFutureInterface<TestParseResultPtr> &fi, const QString &file) {
[codeParsers](QFutureInterface<TestParseResultPtr> &fi, const QString &file) {
parseFileForTests(codeParsers, fi, file);
},
Utils::MapReduceOption::Unordered,
......
......@@ -370,7 +370,7 @@ void TestRunner::debugTests()
connect(outputreader, &TestOutputReader::newOutputAvailable,
TestResultsPane::instance(), &TestResultsPane::addOutput);
connect(runControl, &ProjectExplorer::RunControl::appendMessageRequested,
this, [this, outputreader]
this, [outputreader]
(ProjectExplorer::RunControl *, const QString &msg, Utils::OutputFormat format) {
processOutput(outputreader, msg, format);
});
......
......@@ -277,7 +277,7 @@ QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration
return QList<ConfigModel::DataItem>();
return Utils::transform(m_buildDirManager->parsedConfiguration(),
[this](const CMakeConfigItem &i) {
[](const CMakeConfigItem &i) {
ConfigModel::DataItem j;
j.key = QString::fromUtf8(i.key);
j.value = QString::fromUtf8(i.value);
......
......@@ -334,7 +334,7 @@ void CMakeGeneratorKitConfigWidget::changeGenerator()
for (auto it = generatorList.constBegin(); it != generatorList.constEnd(); ++it)
generatorCombo->addItem(it->name);
auto updateDialog = [this, &generatorList, generatorCombo, extraGeneratorCombo,
auto updateDialog = [&generatorList, generatorCombo, extraGeneratorCombo,
platformEdit, toolsetEdit](const QString &name) {
auto it = std::find_if(generatorList.constBegin(), generatorList.constEnd(),
[name](const CMakeTool::Generator &g) { return g.name == name; });
......
......@@ -148,7 +148,7 @@ KitConfigWidget *CMakeKitInformation::createConfigWidget(Kit *k) const
void CMakeKitInformation::addToMacroExpander(Kit *k, Utils::MacroExpander *expander) const
{
expander->registerFileVariables("CMake:Executable", tr("Path to the cmake executable"),
[this, k]() -> QString {
[k]() -> QString {
CMakeTool *tool = CMakeKitInformation::cmakeTool(k);
return tool ? tool->cmakeExecutable().toString() : QString();
});
......
......@@ -554,7 +554,7 @@ void TeaLeafReader::processCMakeOutput()
{
static QString rest;
rest = lineSplit(rest, m_cmakeProcess->readAllStandardOutput(),
[this](const QString &s) { MessageManager::write(s); });
[](const QString &s) { MessageManager::write(s); });
}
void TeaLeafReader::processCMakeError()
......
......@@ -382,7 +382,7 @@ void EditorManagerPrivate::init()
cmd = ActionManager::registerAction(m_splitAction, Constants::SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(m_splitAction, &QAction::triggered, this, [this]() { split(Qt::Vertical); });
connect(m_splitAction, &QAction::triggered, this, []() { split(Qt::Vertical); });
m_splitSideBySideAction = new QAction(Utils::Icons::SPLIT_VERTICAL.icon(),
tr("Split Side by Side"), this);
......@@ -396,7 +396,7 @@ void EditorManagerPrivate::init()
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,4") : tr("Ctrl+E,4")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(m_splitNewWindowAction, &QAction::triggered,
this, [this]() { splitNewWindow(currentEditorView()); });
this, []() { splitNewWindow(currentEditorView()); });
m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
cmd = ActionManager::registerAction(m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);
......
......@@ -77,7 +77,7 @@ ExternalToolManager::ExternalToolManager()
d->m_configureSeparator = new QAction(this);
d->m_configureSeparator->setSeparator(true);
d->m_configureAction = new QAction(ICore::msgShowOptionsDialog(), this);
connect(d->m_configureAction, &QAction::triggered, [this] {
connect(d->m_configureAction, &QAction::triggered, this, [] {
ICore::showOptionsDialog(Constants::SETTINGS_ID_TOOLS);
});
......
......@@ -192,7 +192,7 @@ void FindPrivate::setupMenu()
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F")));
mfindadvanced->addAction(cmd);
connect(m_openFindDialog, &QAction::triggered,
this, [this] { Find::openFindDialog(nullptr); });
this, [] { Find::openFindDialog(nullptr); });
}
static QString filterActionName(const IFindFilter *filter)
......@@ -220,8 +220,7 @@ void FindPrivate::setupFilterMenuItems()
cmd->setDefaultKeySequence(filter->defaultShortcut());
cmd->setAttribute(Command::CA_UpdateText);
mfindadvanced->addAction(cmd);
connect(action, &QAction::triggered,
this, [filter, action] { Find::openFindDialog(filter); });
connect(action, &QAction::triggered, this, [filter] { Find::openFindDialog(filter); });
connect(filter, &IFindFilter::enabledChanged, this, [filter, action] {
action->setEnabled(filter->isEnabled());
d->m_openFindDialog->setEnabled(d->isAnyFilterEnabled());
......
......@@ -287,7 +287,7 @@ Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, I
s_reopenData.clear();
wizard->deleteLater();
});
connect(wizard, &QObject::destroyed, this, [wizard]() {
connect(wizard, &QObject::destroyed, this, []() {
s_isWizardRunning = false;
s_currentWizard = nullptr;
s_inspectWizardAction->setEnabled(false);
......
......@@ -84,7 +84,7 @@ JsExpander::JsExpander()
QCoreApplication::translate("Core::JsExpander",
"Evaluate simple JavaScript statements.<br>"
"The statements may not contain '{' nor '}' characters."),
[this](QString in) -> QString {
[](QString in) -> QString {
QString errorMessage;
QString result = JsExpander::evaluate(in, &errorMessage);
if (!errorMessage.isEmpty()) {
......
......@@ -505,7 +505,7 @@ void MainWindow::registerDefaultActions()
cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
cmd->setDefaultKeySequence(QKeySequence::New);
mfile->addAction(cmd, Constants::G_FILE_NEW);
connect(m_newAction, &QAction::triggered, this, [this]() {
connect(m_newAction, &QAction::triggered, this, []() {
if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(tr("New File or Project", "Title of dialog"),
IWizardFactory::allWizardFactories(), QString());
......
......@@ -3390,7 +3390,7 @@ public:
auto layout = new QFormLayout(&dlg);
auto funcNameEdit = new Utils::FancyLineEdit;
funcNameEdit->setValidationFunction([this](Utils::FancyLineEdit *edit, QString *) {
funcNameEdit->setValidationFunction([](Utils::FancyLineEdit *edit, QString *) {
return ExtractFunctionOptions::isValidFunctionName(edit->text());
});
layout->addRow(QCoreApplication::translate("QuickFix::ExtractFunction",
......
......@@ -205,10 +205,10 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable("Cpp:LicenseTemplate",
tr("The license template."),
[this]() { return CppToolsPlugin::licenseTemplate(); });
[]() { return CppToolsPlugin::licenseTemplate(); });
expander->registerFileVariables("Cpp:LicenseTemplatePath",
tr("The configured path to the license template"),
[this]() { return CppToolsPlugin::licenseTemplatePath().toString(); });
[]() { return CppToolsPlugin::licenseTemplatePath().toString(); });
return true;
}
......
......@@ -2012,7 +2012,7 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Synchronize Breakpoints"),
Internal::hasSnapshots(),
[this] { Internal::synchronizeBreakpoints(); });
[] { Internal::synchronizeBreakpoints(); });
menu->addSeparator();
menu->addAction(action(UseToolTipsInBreakpointsView));
......
......@@ -445,7 +445,7 @@ void CdbEngine::consoleStubExited()
void CdbEngine::createFullBacktrace()
{
runCommand({"~*kp", BuiltinCommand, [this](const DebuggerResponse &response) {
runCommand({"~*kp", BuiltinCommand, [](const DebuggerResponse &response) {
Internal::openTextEditor("Backtrace $", response.data.data());
}});
}
......@@ -1423,7 +1423,7 @@ void CdbEngine::postDisassemblerCommand(quint64 address, quint64 endAddress,
str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress;
DebuggerCommand cmd;
cmd.function = ba;
cmd.callback = [this, agent](const DebuggerResponse &response) {
cmd.callback = [agent](const DebuggerResponse &response) {
// Parse: "00000000`77606060 cc int 3"
agent->setContents(parseCdbDisassembler(response.data.data()));
};
......
......@@ -228,7 +228,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
setWindowTitle(tr("Start Debugger"));
d->kitChooser = new KitChooser(this);
d->kitChooser->setKitPredicate([this](const Kit *k) {
d->kitChooser->setKitPredicate([](const Kit *k) {
return !DebuggerKitInformation::configurationErrors(k);
});
d->kitChooser->populate();
......
......@@ -300,26 +300,26 @@ KitConfigWidget *DebuggerKitInformation::createConfigWidget(Kit *k) const
void DebuggerKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const
{
expander->registerVariable("Debugger:Name", tr("Name of Debugger"),
[this, kit]() -> QString {
[kit]() -> QString {
const DebuggerItem *item = debugger(kit);
return item ? item->displayName() : tr("Unknown debugger");
});
expander->registerVariable("Debugger:Type", tr("Type of Debugger Backend"),
[this, kit]() -> QString {
[kit]() -> QString {
const DebuggerItem *item = debugger(kit);
return item ? item->engineTypeName() : tr("Unknown debugger type");
});
expander->registerVariable("Debugger:Version", tr("Debugger"),
[this, kit]() -> QString {
[kit]() -> QString {
const DebuggerItem *item = debugger(kit);
return item && !item->version().isEmpty()
? item->version() : tr("Unknown debugger version");
});
expander->registerVariable("Debugger:Abi", tr("Debugger"),
[this, kit]() -> QString {
[kit]() -> QString {
const DebuggerItem *item = debugger(kit);
return item && !item->abis().isEmpty()
? item->abiNames().join(QLatin1Char(' '))
......
......@@ -2347,7 +2347,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
auto act = menu->addAction(args.address
? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16)
: DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber));
connect(act, &QAction::triggered, [this, args] {
connect(act, &QAction::triggered, this, [args] {
DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return);
engine->executeRunToLine(args);
......@@ -2357,7 +2357,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
auto act = menu->addAction(args.address
? DebuggerEngine::tr("Jump to Address 0x%1").arg(args.address, 0, 16)
: DebuggerEngine::tr("Jump to Line %1").arg(args.lineNumber));
connect(act, &QAction::triggered, [this, args] {
connect(act, &QAction::triggered, this, [args] {
DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return);
engine->executeJumpToLine(args);
......@@ -2372,7 +2372,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
const QString text = tr("Disassemble Function \"%1\"")
.arg(frame.function);
auto act = new QAction(text, menu);
connect(act, &QAction::triggered, [this, frame] {
connect(act, &QAction::triggered, this, [frame] {
DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return);
engine->openDisassemblerView(Location(frame));
......@@ -3714,7 +3714,7 @@ void DebuggerUnitTests::testStateMachine()
auto runControl = new RunControl(rc, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto runTool = new DebuggerRunTool(runControl, rp);
connect(runTool, &DebuggerRunTool::stopped, this, [this] {
connect(runTool, &DebuggerRunTool::stopped, this, [] {
QTestEventLoop::instance().exitLoop();
});
......
......@@ -4232,7 +4232,7 @@ void GdbEngine::handleAdapterCrashed(const QString &msg)
void GdbEngine::createFullBacktrace()
{
DebuggerCommand cmd("thread apply all bt full", NeedsTemporaryStop | ConsoleCommand);
cmd.callback = [this](const DebuggerResponse &response) {
cmd.callback = [](const DebuggerResponse &response) {
if (response.resultClass == ResultDone) {
Internal::openTextEditor("Backtrace $",
response.consoleStreamOutput + response.logStreamOutput);
......
......@@ -574,7 +574,7 @@ void LldbEngine::removeBreakpoint(Breakpoint bp)
if (response.id.isValid()) {
DebuggerCommand cmd("removeBreakpoint");
cmd.arg("lldbid", response.id.toString());
cmd.callback = [this, bp](const DebuggerResponse &) {
cmd.callback = [bp](const DebuggerResponse &) {
QTC_CHECK(bp.state() == BreakpointRemoveProceeding);
Breakpoint bp0 = bp;
bp0.notifyBreakpointRemoveOk();
......@@ -679,7 +679,7 @@ void LldbEngine::requestModuleSymbols(const QString &moduleName)
{
DebuggerCommand cmd("fetchSymbols");
cmd.arg("module", moduleName);
cmd.callback = [this, moduleName](const DebuggerResponse &response) {
cmd.callback = [moduleName](const DebuggerResponse &response) {
const GdbMi &symbols = response.data["symbols"];
QString moduleName = response.data["module"].data();
Symbols syms;
......@@ -1041,7 +1041,7 @@ void LldbEngine::fetchMemory(MemoryAgent *agent, quint64 addr, quint64 length)
DebuggerCommand cmd("fetchMemory");
cmd.arg("address", addr);
cmd.arg("length", length);
cmd.callback = [this, agent](const DebuggerResponse &response) {
cmd.callback = [agent](const DebuggerResponse &response) {
qulonglong addr = response.data["address"].toAddress();
QByteArray ba = QByteArray::fromHex(response.data["contents"].data().toUtf8());
agent->addData(addr, ba);
......@@ -1055,7 +1055,7 @@ void LldbEngine::changeMemory(MemoryAgent *agent, quint64 addr, const QByteArray
DebuggerCommand cmd("writeMemory");
cmd.arg("address", addr);
cmd.arg("data", QString::fromUtf8(data.toHex()));
cmd.callback = [this](const DebuggerResponse &response) { Q_UNUSED(response); };
cmd.callback = [](const DebuggerResponse &response) { Q_UNUSED(response); };
runCommand(cmd);
}
......
......@@ -196,7 +196,7 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Show Dependencies of \"%1\"").arg(moduleName),
tr("Show Dependencies"),
moduleNameValid && !moduleName.isEmpty() && HostOsInfo::isWindowsHost(),
[this, modulePath] { QProcess::startDetached("depends", {modulePath}); });
[modulePath] { QProcess::startDetached("depends", {modulePath}); });
addAction(menu, tr("Load Symbols for All Modules"),
enabled && canLoadSymbols,
......
......@@ -742,8 +742,10 @@ bool RegisterHandler::contextMenuEvent(const ItemViewEvent &ev)
? registerSubItem->parent()->m_format
: HexadecimalFormat;
auto addFormatAction = [this, menu, currentFormat, registerItem](const QString &display, RegisterFormat format) {
addCheckableAction(menu, display, registerItem, currentFormat == format, [this, registerItem, format] {
auto addFormatAction =
[menu, currentFormat, registerItem](const QString &display, RegisterFormat format) {
addCheckableAction(menu, display, registerItem, currentFormat == format,
[registerItem, format] {
registerItem->m_format = format;
registerItem->update();
});
......
......@@ -418,7 +418,7 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev)
});
addAction(menu, tr("Disassemble Function..."), true,
[this, address] {
[this] {
const StackFrame frame = inputFunctionForDisassembly();
if (!frame.function.isEmpty())
m_engine->openDisassemblerView(Location(frame));
......
......@@ -1679,7 +1679,7 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Close Editor Tooltips"),
DebuggerToolTipManager::hasToolTips(),
[this] { DebuggerToolTipManager::closeAllToolTips(); });
[] { DebuggerToolTipManager::closeAllToolTips(); });
addAction(menu, tr("Copy View Contents to Clipboard"),
true,
......@@ -1687,7 +1687,7 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Copy Current Value to Clipboard"),
item,
[this, item] { copyToClipboard(item->value); });
[item] { copyToClipboard(item->value); });
// addAction(menu, tr("Copy Selected Rows to Clipboard"),
// selectionModel()->hasSelection(),
......@@ -1791,7 +1791,7 @@ QMenu *WatchModel::createMemoryMenu(WatchItem *item)
addAction(menu, tr("Open Memory Editor Showing Stack Layout"),
item && item->isLocal(),
[this, item, pos] { addStackLayoutMemoryView(false, pos); });
[this, pos] { addStackLayoutMemoryView(false, pos); });
addAction(menu, tr("Open Memory Editor..."),
true,
......@@ -1835,8 +1835,6 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item)
addBaseChangeAction(tr("Show Unprintable Characters as Octal"), 8);
addBaseChangeAction(tr("Show Unprintable Characters as Hexadecimal"), 16);
QAction *act = 0;
const QString spacer = " ";
menu->addSeparator();
......@@ -1858,7 +1856,7 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item)
for (int format : alternativeFormats) {
addCheckableAction(menu, spacer + nameForFormat(format), true, format == individualFormat,
[this, act, format, iname] {
[this, format, iname] {
setIndividualFormat(iname, format);
m_engine->updateLocals();
});
......@@ -1878,7 +1876,7 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item)
for (int format : alternativeFormats) {
addCheckableAction(menu, spacer + nameForFormat(format), true, format == typeFormat,
[this, act, format, item] {
[this, format, item] {
setTypeFormat(item->type, format);
m_engine->updateLocals();
});
......@@ -2094,7 +2092,7 @@ void WatchHandler::notifyUpdateStarted(const UpdateParameters &updateParameters)
void WatchHandler::notifyUpdateFinished()
{
QList<WatchItem *> toRemove;
m_model->forSelectedItems([this, &toRemove](WatchItem *item) {
m_model->forSelectedItems([&toRemove](WatchItem *item) {
if (item->outdated) {
toRemove.append(item);
return false;
......
......@@ -82,7 +82,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
#ifdef CPP_ENABLED
IWizardFactory::registerFactoryCreator(
[this]() -> QList<IWizardFactory *> {
[]() -> QList<IWizardFactory *> {
IWizardFactory *wizard = new FormClassWizard;
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
......
......@@ -694,7 +694,7 @@ void GitClient::diffFiles(const QString &workingDirectory,
+ QLatin1String(".DiffFiles.") + workingDirectory;
requestReload(documentId,
workingDirectory, tr("Git Diff Files"),
[this, workingDirectory, stagedFileNames, unstagedFileNames]
[workingDirectory, stagedFileNames, unstagedFileNames]
(IDocument *doc) -> DiffEditorController* {
return new FileListDiffController(doc, workingDirectory,
stagedFileNames, unstagedFileNames);
......@@ -707,7 +707,7 @@ void GitClient::diffProject(const QString &workingDirectory, const QString &proj
+ QLatin1String(".DiffProject.") + workingDirectory;
requestReload(documentId,
workingDirectory, tr("Git Diff Project"),
[this, workingDirectory, projectDirectory]
[workingDirectory, projectDirectory]
(IDocument *doc) -> DiffEditorController* {
return new ProjectDiffController(doc, workingDirectory, {projectDirectory});
});
......@@ -719,7 +719,7 @@ void GitClient::diffRepository(const QString &workingDirectory)
+ QLatin1String(".DiffRepository.") + workingDirectory;
requestReload(documentId,
workingDirectory, tr("Git Diff Repository"),
[this, workingDirectory](IDocument *doc) -> DiffEditorController* {
[workingDirectory](IDocument *doc) -> DiffEditorController* {
return new RepositoryDiffController(doc, workingDirectory);
});
}
......@@ -731,7 +731,7 @@ void GitClient::diffFile(const QString &workingDirectory, const QString &fileNam
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
+ QLatin1String(".DifFile.") + sourceFile;
requestReload(documentId, sourceFile, title,
[this, workingDirectory, fileName]
[workingDirectory, fileName]
(IDocument *doc) -> DiffEditorController* {
return new FileDiffController(doc, workingDirectory, fileName);
});
......@@ -744,7 +744,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
+ QLatin1String(".DiffBranch.") + branchName;
requestReload(documentId, workingDirectory, title,
[this, workingDirectory, branchName]
[workingDirectory, branchName]
(IDocument *doc) -> DiffEditorController* {
return new BranchDiffController(doc, workingDirectory, branchName);
});
......@@ -851,7 +851,7 @@ void GitClient::show(const QString &source, const QString &id, const QString &na
const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
+ QLatin1String(".Show.") + id;
requestReload(documentId, source, title,
[this, workingDirectory, id]
[workingDirectory, id]
(IDocument *doc) -> DiffEditorController* {
return new ShowController(doc, workingDirectory, id);
});
......@@ -1768,7 +1768,7 @@ bool GitClient::cleanList(const QString &workingDirectory, const QString &module
const QString relativeBase = modulePath.isEmpty() ? QString() : modulePath + '/';
const QString prefix = "Would remove ";
const QStringList removeLines = Utils::filtered(
splitLines(resp.stdOut()), [&prefix](const QString &s) {
splitLines(resp.stdOut()), [](const QString &s) {
return s.startsWith("Would remove ");
});
*files = Utils::transform(removeLines, [&relativeBase, &prefix](const QString &s) -> QString {
......
......@@ -64,56 +64,56 @@ void ImageViewerPlugin::extensionsInitialized()
{
QAction *a = registerNewAction(Constants::ACTION_ZOOM_IN, tr("Zoom In"),
QKeySequence(tr("Ctrl++")));
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->zoomIn();
});
a = registerNewAction(Constants::ACTION_ZOOM_OUT, tr("Zoom Out"),
QKeySequence(tr("Ctrl+-")));
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->zoomOut();
});
a = registerNewAction(Constants::ACTION_ORIGINAL_SIZE, tr("Original Size"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+0") : tr("Ctrl+0")));
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->resetToOriginalSize();
});
a = registerNewAction(Constants::ACTION_FIT_TO_SCREEN, tr("Fit to Screen"),
QKeySequence(tr("Ctrl+=")));
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->fitToScreen();
});
a = registerNewAction(Constants::ACTION_BACKGROUND, tr("Switch Background"),
QKeySequence(tr("Ctrl+[")));
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->switchViewBackground();
});
a = registerNewAction(Constants::ACTION_OUTLINE, tr("Switch Outline"),
QKeySequence(tr("Ctrl+]")));
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->switchViewOutline();
});
a = registerNewAction(Constants::ACTION_TOGGLE_ANIMATION, tr("Toggle Animation"),
QKeySequence());
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->togglePlay();
});
a = registerNewAction(Constants::ACTION_EXPORT_IMAGE, tr("Export Image"),
QKeySequence());
connect(a, &QAction::triggered, this, [this]() {
connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer())
iv->exportImage();
});
......
......@@ -148,7 +148,7 @@ void IosSettingsWidget::onCreate()
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Creating simulator device..."), Utils::NormalMessageFormat);
const auto onSimulatorCreate = [this, statusDialog](const QString &name,
const auto onSimulatorCreate = [statusDialog](const QString &name,
const SimulatorControl::ResponseData &response) {
if (response.success) {
statusDialog->addMessage(tr("Simulator device (%1) created.\nUDID: %2")
......
......@@ -49,7 +49,7 @@ EditorDiagramView::EditorDiagramView(QWidget *parent)
{
auto droputils = new Utils::DropSupport(
this,
[this](QDropEvent *event, Utils::DropSupport *dropSupport)
[](QDropEvent *event, Utils::DropSupport *dropSupport)
-> bool { return dropSupport->isValueDrop(event); });
connect(droputils, &Utils::DropSupport::valuesDropped,
this, &EditorDiagramView::dropProjectExplorerNodes);
......
......@@ -381,13 +381,13 @@ ProcessExtraCompiler::~ProcessExtraCompiler()
void ProcessExtraCompiler::run(const QByteArray &sourceContents)
{
ContentProvider contents = [this, sourceContents]() { return sourceContents; };
ContentProvider contents = [sourceContents]() { return sourceContents; };
runImpl(contents);
}
void ProcessExtraCompiler::run(const Utils::FileName &fileName)
{
ContentProvider contents = [this, fileName]() {
ContentProvider contents = [fileName]() {
QFile file(fileName.toString());
if (!file.open(QFile::ReadOnly | QFile::Text))
return QByteArray();
......
......@@ -101,7 +101,7 @@ KitInformation::ItemList SysRootKitInformation::toUserOutput(const Kit *k) const
void SysRootKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander *expander) const
{
expander->registerFileVariables("SysRoot", tr("Sys Root"), [this, kit]() -> QString {
expander->registerFileVariables("SysRoot", tr("Sys Root"), [kit]() -> QString {
return SysRootKitInformation::sysRoot(kit).toString();
});
}
......@@ -335,24 +335,24 @@ void ToolChainKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander
{
// Compatibility with Qt Creator < 4.2:
expander->registerVariable("Compiler:Name", tr("Compiler"),
[this, kit]() -> QString {
[kit]() -> QString {
const ToolChain *tc = toolChain(kit, Constants::CXX_LANGUAGE_ID);
return tc ? tc->displayName() : tr("None");
});
expander->registerVariable("Compiler:Executable", tr("Path to the compiler executable"),
[this, kit]() -> QString {
[kit]() -> QString {
const ToolChain *tc = toolChain(kit, Constants::CXX_LANGUAGE_ID);
return tc ? tc->compilerCommand().toString() : QString();
});
expander->registerPrefix("Compiler:Name", tr("Compiler for different languages"),
[this, kit](const QString &ls) -> QString {