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 <tim.jenssen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2017-09-07 17:05:47 +02:00
parent e3ae628584
commit 47886969cc
55 changed files with 216 additions and 218 deletions

View File

@@ -397,7 +397,7 @@ void QmlDebugConnection::newConnection()
connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected); connect(socket, &QLocalSocket::disconnected, this, &QmlDebugConnection::socketDisconnected);
connect(socket, static_cast<void (QLocalSocket::*)(QLocalSocket::LocalSocketError)> 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))); emit logError(socketErrorToString(static_cast<QAbstractSocket::SocketError>(error)));
socketDisconnected(); socketDisconnected();
}); });

View File

@@ -57,7 +57,7 @@ void SshAgent::refreshKeysImpl()
if (state() != Connected) if (state() != Connected)
return; return;
const auto keysRequestIt = std::find_if(m_pendingRequests.constBegin(), 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()) { if (keysRequestIt != m_pendingRequests.constEnd()) {
qCDebug(sshLog) << "keys request already pending, not adding another one"; qCDebug(sshLog) << "keys request already pending, not adding another one";
return; return;

View File

@@ -42,7 +42,7 @@ AndroidQmlProfilerSupport::AndroidQmlProfilerSupport(RunControl *runControl)
auto profiler = runControl->createWorker(runControl->runMode()); auto profiler = runControl->createWorker(runControl->runMode());
profiler->addStartDependency(this); 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); profiler->recordData("QmlServerUrl", server);
reportStarted(); reportStarted();
}); });

View File

@@ -116,7 +116,7 @@ void AutotestPlugin::initializeMenuEntries()
action = new QAction(tr("Re&scan Tests"), this); action = new QAction(tr("Re&scan Tests"), this);
command = ActionManager::registerAction(action, Constants::ACTION_SCAN_ID); command = ActionManager::registerAction(action, Constants::ACTION_SCAN_ID);
command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+S"))); command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+S")));
connect(action, &QAction::triggered, [this] () { connect(action, &QAction::triggered, this, [] () {
TestTreeModel::instance()->parser()->updateTestTree(); TestTreeModel::instance()->parser()->updateTestTree();
}); });
menu->addAction(command); menu->addAction(command);

View File

@@ -402,7 +402,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList, ITestParser *pars
parser->init(list); parser->init(list);
QFuture<TestParseResultPtr> future = Utils::map(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); parseFileForTests(codeParsers, fi, file);
}, },
Utils::MapReduceOption::Unordered, Utils::MapReduceOption::Unordered,

View File

@@ -370,7 +370,7 @@ void TestRunner::debugTests()
connect(outputreader, &TestOutputReader::newOutputAvailable, connect(outputreader, &TestOutputReader::newOutputAvailable,
TestResultsPane::instance(), &TestResultsPane::addOutput); TestResultsPane::instance(), &TestResultsPane::addOutput);
connect(runControl, &ProjectExplorer::RunControl::appendMessageRequested, connect(runControl, &ProjectExplorer::RunControl::appendMessageRequested,
this, [this, outputreader] this, [outputreader]
(ProjectExplorer::RunControl *, const QString &msg, Utils::OutputFormat format) { (ProjectExplorer::RunControl *, const QString &msg, Utils::OutputFormat format) {
processOutput(outputreader, msg, format); processOutput(outputreader, msg, format);
}); });

View File

@@ -277,7 +277,7 @@ QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration
return QList<ConfigModel::DataItem>(); return QList<ConfigModel::DataItem>();
return Utils::transform(m_buildDirManager->parsedConfiguration(), return Utils::transform(m_buildDirManager->parsedConfiguration(),
[this](const CMakeConfigItem &i) { [](const CMakeConfigItem &i) {
ConfigModel::DataItem j; ConfigModel::DataItem j;
j.key = QString::fromUtf8(i.key); j.key = QString::fromUtf8(i.key);
j.value = QString::fromUtf8(i.value); j.value = QString::fromUtf8(i.value);

View File

@@ -334,7 +334,7 @@ void CMakeGeneratorKitConfigWidget::changeGenerator()
for (auto it = generatorList.constBegin(); it != generatorList.constEnd(); ++it) for (auto it = generatorList.constBegin(); it != generatorList.constEnd(); ++it)
generatorCombo->addItem(it->name); generatorCombo->addItem(it->name);
auto updateDialog = [this, &generatorList, generatorCombo, extraGeneratorCombo, auto updateDialog = [&generatorList, generatorCombo, extraGeneratorCombo,
platformEdit, toolsetEdit](const QString &name) { platformEdit, toolsetEdit](const QString &name) {
auto it = std::find_if(generatorList.constBegin(), generatorList.constEnd(), auto it = std::find_if(generatorList.constBegin(), generatorList.constEnd(),
[name](const CMakeTool::Generator &g) { return g.name == name; }); [name](const CMakeTool::Generator &g) { return g.name == name; });

View File

@@ -148,7 +148,7 @@ KitConfigWidget *CMakeKitInformation::createConfigWidget(Kit *k) const
void CMakeKitInformation::addToMacroExpander(Kit *k, Utils::MacroExpander *expander) const void CMakeKitInformation::addToMacroExpander(Kit *k, Utils::MacroExpander *expander) const
{ {
expander->registerFileVariables("CMake:Executable", tr("Path to the cmake executable"), expander->registerFileVariables("CMake:Executable", tr("Path to the cmake executable"),
[this, k]() -> QString { [k]() -> QString {
CMakeTool *tool = CMakeKitInformation::cmakeTool(k); CMakeTool *tool = CMakeKitInformation::cmakeTool(k);
return tool ? tool->cmakeExecutable().toString() : QString(); return tool ? tool->cmakeExecutable().toString() : QString();
}); });

View File

@@ -554,7 +554,7 @@ void TeaLeafReader::processCMakeOutput()
{ {
static QString rest; static QString rest;
rest = lineSplit(rest, m_cmakeProcess->readAllStandardOutput(), rest = lineSplit(rest, m_cmakeProcess->readAllStandardOutput(),
[this](const QString &s) { MessageManager::write(s); }); [](const QString &s) { MessageManager::write(s); });
} }
void TeaLeafReader::processCMakeError() void TeaLeafReader::processCMakeError()

View File

@@ -382,7 +382,7 @@ void EditorManagerPrivate::init()
cmd = ActionManager::registerAction(m_splitAction, Constants::SPLIT, editManagerContext); cmd = ActionManager::registerAction(m_splitAction, Constants::SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); 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(), m_splitSideBySideAction = new QAction(Utils::Icons::SPLIT_VERTICAL.icon(),
tr("Split Side by Side"), this); 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"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,4") : tr("Ctrl+E,4")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(m_splitNewWindowAction, &QAction::triggered, connect(m_splitNewWindowAction, &QAction::triggered,
this, [this]() { splitNewWindow(currentEditorView()); }); this, []() { splitNewWindow(currentEditorView()); });
m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this); m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
cmd = ActionManager::registerAction(m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext); cmd = ActionManager::registerAction(m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);

View File

@@ -77,7 +77,7 @@ ExternalToolManager::ExternalToolManager()
d->m_configureSeparator = new QAction(this); d->m_configureSeparator = new QAction(this);
d->m_configureSeparator->setSeparator(true); d->m_configureSeparator->setSeparator(true);
d->m_configureAction = new QAction(ICore::msgShowOptionsDialog(), this); 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); ICore::showOptionsDialog(Constants::SETTINGS_ID_TOOLS);
}); });

View File

@@ -192,7 +192,7 @@ void FindPrivate::setupMenu()
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F")));
mfindadvanced->addAction(cmd); mfindadvanced->addAction(cmd);
connect(m_openFindDialog, &QAction::triggered, connect(m_openFindDialog, &QAction::triggered,
this, [this] { Find::openFindDialog(nullptr); }); this, [] { Find::openFindDialog(nullptr); });
} }
static QString filterActionName(const IFindFilter *filter) static QString filterActionName(const IFindFilter *filter)
@@ -220,8 +220,7 @@ void FindPrivate::setupFilterMenuItems()
cmd->setDefaultKeySequence(filter->defaultShortcut()); cmd->setDefaultKeySequence(filter->defaultShortcut());
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
mfindadvanced->addAction(cmd); mfindadvanced->addAction(cmd);
connect(action, &QAction::triggered, connect(action, &QAction::triggered, this, [filter] { Find::openFindDialog(filter); });
this, [filter, action] { Find::openFindDialog(filter); });
connect(filter, &IFindFilter::enabledChanged, this, [filter, action] { connect(filter, &IFindFilter::enabledChanged, this, [filter, action] {
action->setEnabled(filter->isEnabled()); action->setEnabled(filter->isEnabled());
d->m_openFindDialog->setEnabled(d->isAnyFilterEnabled()); d->m_openFindDialog->setEnabled(d->isAnyFilterEnabled());

View File

@@ -287,7 +287,7 @@ Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, I
s_reopenData.clear(); s_reopenData.clear();
wizard->deleteLater(); wizard->deleteLater();
}); });
connect(wizard, &QObject::destroyed, this, [wizard]() { connect(wizard, &QObject::destroyed, this, []() {
s_isWizardRunning = false; s_isWizardRunning = false;
s_currentWizard = nullptr; s_currentWizard = nullptr;
s_inspectWizardAction->setEnabled(false); s_inspectWizardAction->setEnabled(false);

View File

@@ -84,7 +84,7 @@ JsExpander::JsExpander()
QCoreApplication::translate("Core::JsExpander", QCoreApplication::translate("Core::JsExpander",
"Evaluate simple JavaScript statements.<br>" "Evaluate simple JavaScript statements.<br>"
"The statements may not contain '{' nor '}' characters."), "The statements may not contain '{' nor '}' characters."),
[this](QString in) -> QString { [](QString in) -> QString {
QString errorMessage; QString errorMessage;
QString result = JsExpander::evaluate(in, &errorMessage); QString result = JsExpander::evaluate(in, &errorMessage);
if (!errorMessage.isEmpty()) { if (!errorMessage.isEmpty()) {

View File

@@ -505,7 +505,7 @@ void MainWindow::registerDefaultActions()
cmd = ActionManager::registerAction(m_newAction, Constants::NEW); cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
cmd->setDefaultKeySequence(QKeySequence::New); cmd->setDefaultKeySequence(QKeySequence::New);
mfile->addAction(cmd, Constants::G_FILE_NEW); mfile->addAction(cmd, Constants::G_FILE_NEW);
connect(m_newAction, &QAction::triggered, this, [this]() { connect(m_newAction, &QAction::triggered, this, []() {
if (!ICore::isNewItemDialogRunning()) { if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(tr("New File or Project", "Title of dialog"), ICore::showNewItemDialog(tr("New File or Project", "Title of dialog"),
IWizardFactory::allWizardFactories(), QString()); IWizardFactory::allWizardFactories(), QString());

View File

@@ -3390,7 +3390,7 @@ public:
auto layout = new QFormLayout(&dlg); auto layout = new QFormLayout(&dlg);
auto funcNameEdit = new Utils::FancyLineEdit; auto funcNameEdit = new Utils::FancyLineEdit;
funcNameEdit->setValidationFunction([this](Utils::FancyLineEdit *edit, QString *) { funcNameEdit->setValidationFunction([](Utils::FancyLineEdit *edit, QString *) {
return ExtractFunctionOptions::isValidFunctionName(edit->text()); return ExtractFunctionOptions::isValidFunctionName(edit->text());
}); });
layout->addRow(QCoreApplication::translate("QuickFix::ExtractFunction", layout->addRow(QCoreApplication::translate("QuickFix::ExtractFunction",

View File

@@ -205,10 +205,10 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
Utils::MacroExpander *expander = Utils::globalMacroExpander(); Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable("Cpp:LicenseTemplate", expander->registerVariable("Cpp:LicenseTemplate",
tr("The license template."), tr("The license template."),
[this]() { return CppToolsPlugin::licenseTemplate(); }); []() { return CppToolsPlugin::licenseTemplate(); });
expander->registerFileVariables("Cpp:LicenseTemplatePath", expander->registerFileVariables("Cpp:LicenseTemplatePath",
tr("The configured path to the license template"), tr("The configured path to the license template"),
[this]() { return CppToolsPlugin::licenseTemplatePath().toString(); }); []() { return CppToolsPlugin::licenseTemplatePath().toString(); });
return true; return true;
} }

View File

@@ -2012,7 +2012,7 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Synchronize Breakpoints"), addAction(menu, tr("Synchronize Breakpoints"),
Internal::hasSnapshots(), Internal::hasSnapshots(),
[this] { Internal::synchronizeBreakpoints(); }); [] { Internal::synchronizeBreakpoints(); });
menu->addSeparator(); menu->addSeparator();
menu->addAction(action(UseToolTipsInBreakpointsView)); menu->addAction(action(UseToolTipsInBreakpointsView));

View File

@@ -445,7 +445,7 @@ void CdbEngine::consoleStubExited()
void CdbEngine::createFullBacktrace() void CdbEngine::createFullBacktrace()
{ {
runCommand({"~*kp", BuiltinCommand, [this](const DebuggerResponse &response) { runCommand({"~*kp", BuiltinCommand, [](const DebuggerResponse &response) {
Internal::openTextEditor("Backtrace $", response.data.data()); Internal::openTextEditor("Backtrace $", response.data.data());
}}); }});
} }
@@ -1423,7 +1423,7 @@ void CdbEngine::postDisassemblerCommand(quint64 address, quint64 endAddress,
str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress; str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress;
DebuggerCommand cmd; DebuggerCommand cmd;
cmd.function = ba; cmd.function = ba;
cmd.callback = [this, agent](const DebuggerResponse &response) { cmd.callback = [agent](const DebuggerResponse &response) {
// Parse: "00000000`77606060 cc int 3" // Parse: "00000000`77606060 cc int 3"
agent->setContents(parseCdbDisassembler(response.data.data())); agent->setContents(parseCdbDisassembler(response.data.data()));
}; };

View File

@@ -228,7 +228,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
setWindowTitle(tr("Start Debugger")); setWindowTitle(tr("Start Debugger"));
d->kitChooser = new KitChooser(this); d->kitChooser = new KitChooser(this);
d->kitChooser->setKitPredicate([this](const Kit *k) { d->kitChooser->setKitPredicate([](const Kit *k) {
return !DebuggerKitInformation::configurationErrors(k); return !DebuggerKitInformation::configurationErrors(k);
}); });
d->kitChooser->populate(); d->kitChooser->populate();

View File

@@ -300,26 +300,26 @@ KitConfigWidget *DebuggerKitInformation::createConfigWidget(Kit *k) const
void DebuggerKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const void DebuggerKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const
{ {
expander->registerVariable("Debugger:Name", tr("Name of Debugger"), expander->registerVariable("Debugger:Name", tr("Name of Debugger"),
[this, kit]() -> QString { [kit]() -> QString {
const DebuggerItem *item = debugger(kit); const DebuggerItem *item = debugger(kit);
return item ? item->displayName() : tr("Unknown debugger"); return item ? item->displayName() : tr("Unknown debugger");
}); });
expander->registerVariable("Debugger:Type", tr("Type of Debugger Backend"), expander->registerVariable("Debugger:Type", tr("Type of Debugger Backend"),
[this, kit]() -> QString { [kit]() -> QString {
const DebuggerItem *item = debugger(kit); const DebuggerItem *item = debugger(kit);
return item ? item->engineTypeName() : tr("Unknown debugger type"); return item ? item->engineTypeName() : tr("Unknown debugger type");
}); });
expander->registerVariable("Debugger:Version", tr("Debugger"), expander->registerVariable("Debugger:Version", tr("Debugger"),
[this, kit]() -> QString { [kit]() -> QString {
const DebuggerItem *item = debugger(kit); const DebuggerItem *item = debugger(kit);
return item && !item->version().isEmpty() return item && !item->version().isEmpty()
? item->version() : tr("Unknown debugger version"); ? item->version() : tr("Unknown debugger version");
}); });
expander->registerVariable("Debugger:Abi", tr("Debugger"), expander->registerVariable("Debugger:Abi", tr("Debugger"),
[this, kit]() -> QString { [kit]() -> QString {
const DebuggerItem *item = debugger(kit); const DebuggerItem *item = debugger(kit);
return item && !item->abis().isEmpty() return item && !item->abis().isEmpty()
? item->abiNames().join(QLatin1Char(' ')) ? item->abiNames().join(QLatin1Char(' '))

View File

@@ -2347,7 +2347,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
auto act = menu->addAction(args.address auto act = menu->addAction(args.address
? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16) ? DebuggerEngine::tr("Run to Address 0x%1").arg(args.address, 0, 16)
: DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber)); : DebuggerEngine::tr("Run to Line %1").arg(args.lineNumber));
connect(act, &QAction::triggered, [this, args] { connect(act, &QAction::triggered, this, [args] {
DebuggerEngine *engine = currentEngine(); DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return); QTC_ASSERT(engine, return);
engine->executeRunToLine(args); engine->executeRunToLine(args);
@@ -2357,7 +2357,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
auto act = menu->addAction(args.address auto act = menu->addAction(args.address
? DebuggerEngine::tr("Jump to Address 0x%1").arg(args.address, 0, 16) ? DebuggerEngine::tr("Jump to Address 0x%1").arg(args.address, 0, 16)
: DebuggerEngine::tr("Jump to Line %1").arg(args.lineNumber)); : DebuggerEngine::tr("Jump to Line %1").arg(args.lineNumber));
connect(act, &QAction::triggered, [this, args] { connect(act, &QAction::triggered, this, [args] {
DebuggerEngine *engine = currentEngine(); DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return); QTC_ASSERT(engine, return);
engine->executeJumpToLine(args); engine->executeJumpToLine(args);
@@ -2372,7 +2372,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
const QString text = tr("Disassemble Function \"%1\"") const QString text = tr("Disassemble Function \"%1\"")
.arg(frame.function); .arg(frame.function);
auto act = new QAction(text, menu); auto act = new QAction(text, menu);
connect(act, &QAction::triggered, [this, frame] { connect(act, &QAction::triggered, this, [frame] {
DebuggerEngine *engine = currentEngine(); DebuggerEngine *engine = currentEngine();
QTC_ASSERT(engine, return); QTC_ASSERT(engine, return);
engine->openDisassemblerView(Location(frame)); engine->openDisassemblerView(Location(frame));
@@ -3714,7 +3714,7 @@ void DebuggerUnitTests::testStateMachine()
auto runControl = new RunControl(rc, ProjectExplorer::Constants::DEBUG_RUN_MODE); auto runControl = new RunControl(rc, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto runTool = new DebuggerRunTool(runControl, rp); auto runTool = new DebuggerRunTool(runControl, rp);
connect(runTool, &DebuggerRunTool::stopped, this, [this] { connect(runTool, &DebuggerRunTool::stopped, this, [] {
QTestEventLoop::instance().exitLoop(); QTestEventLoop::instance().exitLoop();
}); });

View File

@@ -4232,7 +4232,7 @@ void GdbEngine::handleAdapterCrashed(const QString &msg)
void GdbEngine::createFullBacktrace() void GdbEngine::createFullBacktrace()
{ {
DebuggerCommand cmd("thread apply all bt full", NeedsTemporaryStop | ConsoleCommand); DebuggerCommand cmd("thread apply all bt full", NeedsTemporaryStop | ConsoleCommand);
cmd.callback = [this](const DebuggerResponse &response) { cmd.callback = [](const DebuggerResponse &response) {
if (response.resultClass == ResultDone) { if (response.resultClass == ResultDone) {
Internal::openTextEditor("Backtrace $", Internal::openTextEditor("Backtrace $",
response.consoleStreamOutput + response.logStreamOutput); response.consoleStreamOutput + response.logStreamOutput);

View File

@@ -574,7 +574,7 @@ void LldbEngine::removeBreakpoint(Breakpoint bp)
if (response.id.isValid()) { if (response.id.isValid()) {
DebuggerCommand cmd("removeBreakpoint"); DebuggerCommand cmd("removeBreakpoint");
cmd.arg("lldbid", response.id.toString()); cmd.arg("lldbid", response.id.toString());
cmd.callback = [this, bp](const DebuggerResponse &) { cmd.callback = [bp](const DebuggerResponse &) {
QTC_CHECK(bp.state() == BreakpointRemoveProceeding); QTC_CHECK(bp.state() == BreakpointRemoveProceeding);
Breakpoint bp0 = bp; Breakpoint bp0 = bp;
bp0.notifyBreakpointRemoveOk(); bp0.notifyBreakpointRemoveOk();
@@ -679,7 +679,7 @@ void LldbEngine::requestModuleSymbols(const QString &moduleName)
{ {
DebuggerCommand cmd("fetchSymbols"); DebuggerCommand cmd("fetchSymbols");
cmd.arg("module", moduleName); cmd.arg("module", moduleName);
cmd.callback = [this, moduleName](const DebuggerResponse &response) { cmd.callback = [moduleName](const DebuggerResponse &response) {
const GdbMi &symbols = response.data["symbols"]; const GdbMi &symbols = response.data["symbols"];
QString moduleName = response.data["module"].data(); QString moduleName = response.data["module"].data();
Symbols syms; Symbols syms;
@@ -1041,7 +1041,7 @@ void LldbEngine::fetchMemory(MemoryAgent *agent, quint64 addr, quint64 length)
DebuggerCommand cmd("fetchMemory"); DebuggerCommand cmd("fetchMemory");
cmd.arg("address", addr); cmd.arg("address", addr);
cmd.arg("length", length); cmd.arg("length", length);
cmd.callback = [this, agent](const DebuggerResponse &response) { cmd.callback = [agent](const DebuggerResponse &response) {
qulonglong addr = response.data["address"].toAddress(); qulonglong addr = response.data["address"].toAddress();
QByteArray ba = QByteArray::fromHex(response.data["contents"].data().toUtf8()); QByteArray ba = QByteArray::fromHex(response.data["contents"].data().toUtf8());
agent->addData(addr, ba); agent->addData(addr, ba);
@@ -1055,7 +1055,7 @@ void LldbEngine::changeMemory(MemoryAgent *agent, quint64 addr, const QByteArray
DebuggerCommand cmd("writeMemory"); DebuggerCommand cmd("writeMemory");
cmd.arg("address", addr); cmd.arg("address", addr);
cmd.arg("data", QString::fromUtf8(data.toHex())); 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); runCommand(cmd);
} }

View File

@@ -196,7 +196,7 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Show Dependencies of \"%1\"").arg(moduleName), addAction(menu, tr("Show Dependencies of \"%1\"").arg(moduleName),
tr("Show Dependencies"), tr("Show Dependencies"),
moduleNameValid && !moduleName.isEmpty() && HostOsInfo::isWindowsHost(), moduleNameValid && !moduleName.isEmpty() && HostOsInfo::isWindowsHost(),
[this, modulePath] { QProcess::startDetached("depends", {modulePath}); }); [modulePath] { QProcess::startDetached("depends", {modulePath}); });
addAction(menu, tr("Load Symbols for All Modules"), addAction(menu, tr("Load Symbols for All Modules"),
enabled && canLoadSymbols, enabled && canLoadSymbols,

View File

@@ -742,8 +742,10 @@ bool RegisterHandler::contextMenuEvent(const ItemViewEvent &ev)
? registerSubItem->parent()->m_format ? registerSubItem->parent()->m_format
: HexadecimalFormat; : HexadecimalFormat;
auto addFormatAction = [this, menu, currentFormat, registerItem](const QString &display, RegisterFormat format) { auto addFormatAction =
addCheckableAction(menu, display, registerItem, currentFormat == format, [this, registerItem, format] { [menu, currentFormat, registerItem](const QString &display, RegisterFormat format) {
addCheckableAction(menu, display, registerItem, currentFormat == format,
[registerItem, format] {
registerItem->m_format = format; registerItem->m_format = format;
registerItem->update(); registerItem->update();
}); });

View File

@@ -418,7 +418,7 @@ bool StackHandler::contextMenuEvent(const ItemViewEvent &ev)
}); });
addAction(menu, tr("Disassemble Function..."), true, addAction(menu, tr("Disassemble Function..."), true,
[this, address] { [this] {
const StackFrame frame = inputFunctionForDisassembly(); const StackFrame frame = inputFunctionForDisassembly();
if (!frame.function.isEmpty()) if (!frame.function.isEmpty())
m_engine->openDisassemblerView(Location(frame)); m_engine->openDisassemblerView(Location(frame));

View File

@@ -1679,7 +1679,7 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Close Editor Tooltips"), addAction(menu, tr("Close Editor Tooltips"),
DebuggerToolTipManager::hasToolTips(), DebuggerToolTipManager::hasToolTips(),
[this] { DebuggerToolTipManager::closeAllToolTips(); }); [] { DebuggerToolTipManager::closeAllToolTips(); });
addAction(menu, tr("Copy View Contents to Clipboard"), addAction(menu, tr("Copy View Contents to Clipboard"),
true, true,
@@ -1687,7 +1687,7 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
addAction(menu, tr("Copy Current Value to Clipboard"), addAction(menu, tr("Copy Current Value to Clipboard"),
item, item,
[this, item] { copyToClipboard(item->value); }); [item] { copyToClipboard(item->value); });
// addAction(menu, tr("Copy Selected Rows to Clipboard"), // addAction(menu, tr("Copy Selected Rows to Clipboard"),
// selectionModel()->hasSelection(), // selectionModel()->hasSelection(),
@@ -1791,7 +1791,7 @@ QMenu *WatchModel::createMemoryMenu(WatchItem *item)
addAction(menu, tr("Open Memory Editor Showing Stack Layout"), addAction(menu, tr("Open Memory Editor Showing Stack Layout"),
item && item->isLocal(), item && item->isLocal(),
[this, item, pos] { addStackLayoutMemoryView(false, pos); }); [this, pos] { addStackLayoutMemoryView(false, pos); });
addAction(menu, tr("Open Memory Editor..."), addAction(menu, tr("Open Memory Editor..."),
true, true,
@@ -1835,8 +1835,6 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item)
addBaseChangeAction(tr("Show Unprintable Characters as Octal"), 8); addBaseChangeAction(tr("Show Unprintable Characters as Octal"), 8);
addBaseChangeAction(tr("Show Unprintable Characters as Hexadecimal"), 16); addBaseChangeAction(tr("Show Unprintable Characters as Hexadecimal"), 16);
QAction *act = 0;
const QString spacer = " "; const QString spacer = " ";
menu->addSeparator(); menu->addSeparator();
@@ -1858,7 +1856,7 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item)
for (int format : alternativeFormats) { for (int format : alternativeFormats) {
addCheckableAction(menu, spacer + nameForFormat(format), true, format == individualFormat, addCheckableAction(menu, spacer + nameForFormat(format), true, format == individualFormat,
[this, act, format, iname] { [this, format, iname] {
setIndividualFormat(iname, format); setIndividualFormat(iname, format);
m_engine->updateLocals(); m_engine->updateLocals();
}); });
@@ -1878,7 +1876,7 @@ QMenu *WatchModel::createFormatMenu(WatchItem *item)
for (int format : alternativeFormats) { for (int format : alternativeFormats) {
addCheckableAction(menu, spacer + nameForFormat(format), true, format == typeFormat, addCheckableAction(menu, spacer + nameForFormat(format), true, format == typeFormat,
[this, act, format, item] { [this, format, item] {
setTypeFormat(item->type, format); setTypeFormat(item->type, format);
m_engine->updateLocals(); m_engine->updateLocals();
}); });
@@ -2094,7 +2092,7 @@ void WatchHandler::notifyUpdateStarted(const UpdateParameters &updateParameters)
void WatchHandler::notifyUpdateFinished() void WatchHandler::notifyUpdateFinished()
{ {
QList<WatchItem *> toRemove; QList<WatchItem *> toRemove;
m_model->forSelectedItems([this, &toRemove](WatchItem *item) { m_model->forSelectedItems([&toRemove](WatchItem *item) {
if (item->outdated) { if (item->outdated) {
toRemove.append(item); toRemove.append(item);
return false; return false;

View File

@@ -82,7 +82,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
#ifdef CPP_ENABLED #ifdef CPP_ENABLED
IWizardFactory::registerFactoryCreator( IWizardFactory::registerFactoryCreator(
[this]() -> QList<IWizardFactory *> { []() -> QList<IWizardFactory *> {
IWizardFactory *wizard = new FormClassWizard; IWizardFactory *wizard = new FormClassWizard;
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT)); wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT)); wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));

View File

@@ -694,7 +694,7 @@ void GitClient::diffFiles(const QString &workingDirectory,
+ QLatin1String(".DiffFiles.") + workingDirectory; + QLatin1String(".DiffFiles.") + workingDirectory;
requestReload(documentId, requestReload(documentId,
workingDirectory, tr("Git Diff Files"), workingDirectory, tr("Git Diff Files"),
[this, workingDirectory, stagedFileNames, unstagedFileNames] [workingDirectory, stagedFileNames, unstagedFileNames]
(IDocument *doc) -> DiffEditorController* { (IDocument *doc) -> DiffEditorController* {
return new FileListDiffController(doc, workingDirectory, return new FileListDiffController(doc, workingDirectory,
stagedFileNames, unstagedFileNames); stagedFileNames, unstagedFileNames);
@@ -707,7 +707,7 @@ void GitClient::diffProject(const QString &workingDirectory, const QString &proj
+ QLatin1String(".DiffProject.") + workingDirectory; + QLatin1String(".DiffProject.") + workingDirectory;
requestReload(documentId, requestReload(documentId,
workingDirectory, tr("Git Diff Project"), workingDirectory, tr("Git Diff Project"),
[this, workingDirectory, projectDirectory] [workingDirectory, projectDirectory]
(IDocument *doc) -> DiffEditorController* { (IDocument *doc) -> DiffEditorController* {
return new ProjectDiffController(doc, workingDirectory, {projectDirectory}); return new ProjectDiffController(doc, workingDirectory, {projectDirectory});
}); });
@@ -719,7 +719,7 @@ void GitClient::diffRepository(const QString &workingDirectory)
+ QLatin1String(".DiffRepository.") + workingDirectory; + QLatin1String(".DiffRepository.") + workingDirectory;
requestReload(documentId, requestReload(documentId,
workingDirectory, tr("Git Diff Repository"), workingDirectory, tr("Git Diff Repository"),
[this, workingDirectory](IDocument *doc) -> DiffEditorController* { [workingDirectory](IDocument *doc) -> DiffEditorController* {
return new RepositoryDiffController(doc, workingDirectory); 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) const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
+ QLatin1String(".DifFile.") + sourceFile; + QLatin1String(".DifFile.") + sourceFile;
requestReload(documentId, sourceFile, title, requestReload(documentId, sourceFile, title,
[this, workingDirectory, fileName] [workingDirectory, fileName]
(IDocument *doc) -> DiffEditorController* { (IDocument *doc) -> DiffEditorController* {
return new FileDiffController(doc, workingDirectory, fileName); return new FileDiffController(doc, workingDirectory, fileName);
}); });
@@ -744,7 +744,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
const QString documentId = QLatin1String(Constants::GIT_PLUGIN) const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
+ QLatin1String(".DiffBranch.") + branchName; + QLatin1String(".DiffBranch.") + branchName;
requestReload(documentId, workingDirectory, title, requestReload(documentId, workingDirectory, title,
[this, workingDirectory, branchName] [workingDirectory, branchName]
(IDocument *doc) -> DiffEditorController* { (IDocument *doc) -> DiffEditorController* {
return new BranchDiffController(doc, workingDirectory, branchName); 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) const QString documentId = QLatin1String(Constants::GIT_PLUGIN)
+ QLatin1String(".Show.") + id; + QLatin1String(".Show.") + id;
requestReload(documentId, source, title, requestReload(documentId, source, title,
[this, workingDirectory, id] [workingDirectory, id]
(IDocument *doc) -> DiffEditorController* { (IDocument *doc) -> DiffEditorController* {
return new ShowController(doc, workingDirectory, id); 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 relativeBase = modulePath.isEmpty() ? QString() : modulePath + '/';
const QString prefix = "Would remove "; const QString prefix = "Would remove ";
const QStringList removeLines = Utils::filtered( const QStringList removeLines = Utils::filtered(
splitLines(resp.stdOut()), [&prefix](const QString &s) { splitLines(resp.stdOut()), [](const QString &s) {
return s.startsWith("Would remove "); return s.startsWith("Would remove ");
}); });
*files = Utils::transform(removeLines, [&relativeBase, &prefix](const QString &s) -> QString { *files = Utils::transform(removeLines, [&relativeBase, &prefix](const QString &s) -> QString {

View File

@@ -64,56 +64,56 @@ void ImageViewerPlugin::extensionsInitialized()
{ {
QAction *a = registerNewAction(Constants::ACTION_ZOOM_IN, tr("Zoom In"), QAction *a = registerNewAction(Constants::ACTION_ZOOM_IN, tr("Zoom In"),
QKeySequence(tr("Ctrl++"))); QKeySequence(tr("Ctrl++")));
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->zoomIn(); iv->zoomIn();
}); });
a = registerNewAction(Constants::ACTION_ZOOM_OUT, tr("Zoom Out"), a = registerNewAction(Constants::ACTION_ZOOM_OUT, tr("Zoom Out"),
QKeySequence(tr("Ctrl+-"))); QKeySequence(tr("Ctrl+-")));
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->zoomOut(); iv->zoomOut();
}); });
a = registerNewAction(Constants::ACTION_ORIGINAL_SIZE, tr("Original Size"), a = registerNewAction(Constants::ACTION_ORIGINAL_SIZE, tr("Original Size"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+0") : tr("Ctrl+0"))); QKeySequence(Core::UseMacShortcuts ? tr("Meta+0") : tr("Ctrl+0")));
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->resetToOriginalSize(); iv->resetToOriginalSize();
}); });
a = registerNewAction(Constants::ACTION_FIT_TO_SCREEN, tr("Fit to Screen"), a = registerNewAction(Constants::ACTION_FIT_TO_SCREEN, tr("Fit to Screen"),
QKeySequence(tr("Ctrl+="))); QKeySequence(tr("Ctrl+=")));
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->fitToScreen(); iv->fitToScreen();
}); });
a = registerNewAction(Constants::ACTION_BACKGROUND, tr("Switch Background"), a = registerNewAction(Constants::ACTION_BACKGROUND, tr("Switch Background"),
QKeySequence(tr("Ctrl+["))); QKeySequence(tr("Ctrl+[")));
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->switchViewBackground(); iv->switchViewBackground();
}); });
a = registerNewAction(Constants::ACTION_OUTLINE, tr("Switch Outline"), a = registerNewAction(Constants::ACTION_OUTLINE, tr("Switch Outline"),
QKeySequence(tr("Ctrl+]"))); QKeySequence(tr("Ctrl+]")));
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->switchViewOutline(); iv->switchViewOutline();
}); });
a = registerNewAction(Constants::ACTION_TOGGLE_ANIMATION, tr("Toggle Animation"), a = registerNewAction(Constants::ACTION_TOGGLE_ANIMATION, tr("Toggle Animation"),
QKeySequence()); QKeySequence());
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->togglePlay(); iv->togglePlay();
}); });
a = registerNewAction(Constants::ACTION_EXPORT_IMAGE, tr("Export Image"), a = registerNewAction(Constants::ACTION_EXPORT_IMAGE, tr("Export Image"),
QKeySequence()); QKeySequence());
connect(a, &QAction::triggered, this, [this]() { connect(a, &QAction::triggered, this, []() {
if (ImageViewer *iv = currentImageViewer()) if (ImageViewer *iv = currentImageViewer())
iv->exportImage(); iv->exportImage();
}); });

View File

@@ -148,7 +148,7 @@ void IosSettingsWidget::onCreate()
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this); QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose); statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Creating simulator device..."), Utils::NormalMessageFormat); 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) { const SimulatorControl::ResponseData &response) {
if (response.success) { if (response.success) {
statusDialog->addMessage(tr("Simulator device (%1) created.\nUDID: %2") statusDialog->addMessage(tr("Simulator device (%1) created.\nUDID: %2")

View File

@@ -49,7 +49,7 @@ EditorDiagramView::EditorDiagramView(QWidget *parent)
{ {
auto droputils = new Utils::DropSupport( auto droputils = new Utils::DropSupport(
this, this,
[this](QDropEvent *event, Utils::DropSupport *dropSupport) [](QDropEvent *event, Utils::DropSupport *dropSupport)
-> bool { return dropSupport->isValueDrop(event); }); -> bool { return dropSupport->isValueDrop(event); });
connect(droputils, &Utils::DropSupport::valuesDropped, connect(droputils, &Utils::DropSupport::valuesDropped,
this, &EditorDiagramView::dropProjectExplorerNodes); this, &EditorDiagramView::dropProjectExplorerNodes);

View File

@@ -381,13 +381,13 @@ ProcessExtraCompiler::~ProcessExtraCompiler()
void ProcessExtraCompiler::run(const QByteArray &sourceContents) void ProcessExtraCompiler::run(const QByteArray &sourceContents)
{ {
ContentProvider contents = [this, sourceContents]() { return sourceContents; }; ContentProvider contents = [sourceContents]() { return sourceContents; };
runImpl(contents); runImpl(contents);
} }
void ProcessExtraCompiler::run(const Utils::FileName &fileName) void ProcessExtraCompiler::run(const Utils::FileName &fileName)
{ {
ContentProvider contents = [this, fileName]() { ContentProvider contents = [fileName]() {
QFile file(fileName.toString()); QFile file(fileName.toString());
if (!file.open(QFile::ReadOnly | QFile::Text)) if (!file.open(QFile::ReadOnly | QFile::Text))
return QByteArray(); return QByteArray();

View File

@@ -101,7 +101,7 @@ KitInformation::ItemList SysRootKitInformation::toUserOutput(const Kit *k) const
void SysRootKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander *expander) 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(); return SysRootKitInformation::sysRoot(kit).toString();
}); });
} }
@@ -335,24 +335,24 @@ void ToolChainKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander
{ {
// Compatibility with Qt Creator < 4.2: // Compatibility with Qt Creator < 4.2:
expander->registerVariable("Compiler:Name", tr("Compiler"), expander->registerVariable("Compiler:Name", tr("Compiler"),
[this, kit]() -> QString { [kit]() -> QString {
const ToolChain *tc = toolChain(kit, Constants::CXX_LANGUAGE_ID); const ToolChain *tc = toolChain(kit, Constants::CXX_LANGUAGE_ID);
return tc ? tc->displayName() : tr("None"); return tc ? tc->displayName() : tr("None");
}); });
expander->registerVariable("Compiler:Executable", tr("Path to the compiler executable"), expander->registerVariable("Compiler:Executable", tr("Path to the compiler executable"),
[this, kit]() -> QString { [kit]() -> QString {
const ToolChain *tc = toolChain(kit, Constants::CXX_LANGUAGE_ID); const ToolChain *tc = toolChain(kit, Constants::CXX_LANGUAGE_ID);
return tc ? tc->compilerCommand().toString() : QString(); return tc ? tc->compilerCommand().toString() : QString();
}); });
expander->registerPrefix("Compiler:Name", tr("Compiler for different languages"), expander->registerPrefix("Compiler:Name", tr("Compiler for different languages"),
[this, kit](const QString &ls) -> QString { [kit](const QString &ls) -> QString {
const ToolChain *tc = toolChain(kit, findLanguage(ls)); const ToolChain *tc = toolChain(kit, findLanguage(ls));
return tc ? tc->displayName() : tr("None"); return tc ? tc->displayName() : tr("None");
}); });
expander->registerPrefix("Compiler:Executable", tr("Compiler executable for different languages"), expander->registerPrefix("Compiler:Executable", tr("Compiler executable for different languages"),
[this, kit](const QString &ls) -> QString { [kit](const QString &ls) -> QString {
const ToolChain *tc = toolChain(kit, findLanguage(ls)); const ToolChain *tc = toolChain(kit, findLanguage(ls));
return tc ? tc->compilerCommand().toString() : QString(); return tc ? tc->compilerCommand().toString() : QString();
}); });
@@ -518,7 +518,7 @@ void ToolChainKitInformation::kitsWereLoaded()
void ToolChainKitInformation::toolChainUpdated(ToolChain *tc) void ToolChainKitInformation::toolChainUpdated(ToolChain *tc)
{ {
for (Kit *k : KitManager::kits([tc, this](const Kit *k) { return toolChain(k, tc->language()) == tc; })) for (Kit *k : KitManager::kits([tc](const Kit *k) { return toolChain(k, tc->language()) == tc; }))
notifyAboutUpdate(k); notifyAboutUpdate(k);
} }
@@ -691,27 +691,27 @@ KitInformation::ItemList DeviceKitInformation::toUserOutput(const Kit *k) const
void DeviceKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander *expander) const void DeviceKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander *expander) const
{ {
expander->registerVariable("Device:HostAddress", tr("Host address"), expander->registerVariable("Device:HostAddress", tr("Host address"),
[this, kit]() -> QString { [kit]() -> QString {
const IDevice::ConstPtr device = DeviceKitInformation::device(kit); const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
return device ? device->sshParameters().host : QString(); return device ? device->sshParameters().host : QString();
}); });
expander->registerVariable("Device:SshPort", tr("SSH port"), expander->registerVariable("Device:SshPort", tr("SSH port"),
[this, kit]() -> QString { [kit]() -> QString {
const IDevice::ConstPtr device = DeviceKitInformation::device(kit); const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
return device ? QString::number(device->sshParameters().port) : QString(); return device ? QString::number(device->sshParameters().port) : QString();
}); });
expander->registerVariable("Device:UserName", tr("User name"), expander->registerVariable("Device:UserName", tr("User name"),
[this, kit]() -> QString { [kit]() -> QString {
const IDevice::ConstPtr device = DeviceKitInformation::device(kit); const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
return device ? device->sshParameters().userName : QString(); return device ? device->sshParameters().userName : QString();
}); });
expander->registerVariable("Device:KeyFile", tr("Private key file"), expander->registerVariable("Device:KeyFile", tr("Private key file"),
[this, kit]() -> QString { [kit]() -> QString {
const IDevice::ConstPtr device = DeviceKitInformation::device(kit); const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
return device ? device->sshParameters().privateKeyFile : QString(); return device ? device->sshParameters().privateKeyFile : QString();
}); });
expander->registerVariable("Device:Name", tr("Device name"), expander->registerVariable("Device:Name", tr("Device name"),
[this, kit]() -> QString { [kit]() -> QString {
const IDevice::ConstPtr device = DeviceKitInformation::device(kit); const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
return device ? device->displayName() : QString(); return device ? device->displayName() : QString();
}); });

View File

@@ -238,7 +238,6 @@ const char G_BUILD_CANCEL[] = "ProjectExplorer.Group.BuildCancel";
const char RUNMENUCONTEXTMENU[] = "Project.RunMenu"; const char RUNMENUCONTEXTMENU[] = "Project.RunMenu";
const char FOLDER_OPEN_LOCATIONS_CONTEXT_MENU[] = "Project.F.OpenLocation.CtxMenu"; const char FOLDER_OPEN_LOCATIONS_CONTEXT_MENU[] = "Project.F.OpenLocation.CtxMenu";
const char PROJECT_OPEN_LOCATIONS_CONTEXT_MENU[] = "Project.P.OpenLocation.CtxMenu"; const char PROJECT_OPEN_LOCATIONS_CONTEXT_MENU[] = "Project.P.OpenLocation.CtxMenu";
const char SUBPROJECT_OPEN_LOCATIONS_CONTEXT_MENU[] = "Project.S.OpenLocation.CtxMenu";
} // namespace Constants } // namespace Constants
@@ -616,7 +615,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new ConfigTaskHandler(Task::compilerMissingTask(), addAutoReleasedObject(new ConfigTaskHandler(Task::compilerMissingTask(),
Constants::KITS_SETTINGS_PAGE_ID)); Constants::KITS_SETTINGS_PAGE_ID));
ICore::addPreCloseListener([this]() -> bool { return coreAboutToClose(); }); ICore::addPreCloseListener([]() -> bool { return coreAboutToClose(); });
dd->m_outputPane = new AppOutputPane; dd->m_outputPane = new AppOutputPane;
addAutoReleasedObject(dd->m_outputPane); addAutoReleasedObject(dd->m_outputPane);
@@ -1193,7 +1192,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(ICore::instance(), &ICore::saveSettingsRequested, connect(ICore::instance(), &ICore::saveSettingsRequested,
dd, &ProjectExplorerPluginPrivate::savePersistentSettings); dd, &ProjectExplorerPluginPrivate::savePersistentSettings);
connect(EditorManager::instance(), &EditorManager::autoSaved, this, [this] { connect(EditorManager::instance(), &EditorManager::autoSaved, this, [] {
if (!dd->m_shuttingDown && !SessionManager::loadingSession()) if (!dd->m_shuttingDown && !SessionManager::loadingSession())
SessionManager::save(); SessionManager::save();
}); });
@@ -1267,79 +1266,78 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd, &ProjectExplorerPlugin::openNewProjectDialog); dd, &ProjectExplorerPlugin::openNewProjectDialog);
connect(dd->m_loadAction, &QAction::triggered, connect(dd->m_loadAction, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::loadAction); dd, &ProjectExplorerPluginPrivate::loadAction);
connect(dd->m_buildProjectOnlyAction, &QAction::triggered, dd, [this] { connect(dd->m_buildProjectOnlyAction, &QAction::triggered, dd, [] {
dd->queue({ SessionManager::startupProject() }, { Id(Constants::BUILDSTEPS_BUILD) }); dd->queue({ SessionManager::startupProject() }, { Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_buildAction, &QAction::triggered, connect(dd->m_buildAction, &QAction::triggered, dd, [] {
dd, [this] {
dd->queue(SessionManager::projectOrder(SessionManager::startupProject()), dd->queue(SessionManager::projectOrder(SessionManager::startupProject()),
{ Id(Constants::BUILDSTEPS_BUILD) }); { Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_buildActionContextMenu, &QAction::triggered, dd, [this] { connect(dd->m_buildActionContextMenu, &QAction::triggered, dd, [] {
dd->queue({ ProjectTree::currentProject() }, { Id(Constants::BUILDSTEPS_BUILD) }); dd->queue({ ProjectTree::currentProject() }, { Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_buildDependenciesActionContextMenu, &QAction::triggered, dd, [this] { connect(dd->m_buildDependenciesActionContextMenu, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()), dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()),
{ Id(Constants::BUILDSTEPS_BUILD) }); { Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_buildSessionAction, &QAction::triggered, dd, [this] { connect(dd->m_buildSessionAction, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(), { Id(Constants::BUILDSTEPS_BUILD) }); dd->queue(SessionManager::projectOrder(), { Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_rebuildProjectOnlyAction, &QAction::triggered, dd, [this] { connect(dd->m_rebuildProjectOnlyAction, &QAction::triggered, dd, [] {
dd->queue({ SessionManager::startupProject() }, dd->queue({ SessionManager::startupProject() },
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) }); { Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_rebuildAction, &QAction::triggered, dd, [this] { connect(dd->m_rebuildAction, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(SessionManager::startupProject()), dd->queue(SessionManager::projectOrder(SessionManager::startupProject()),
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) }); { Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_rebuildActionContextMenu, &QAction::triggered, dd, [this] { connect(dd->m_rebuildActionContextMenu, &QAction::triggered, dd, [] {
dd->queue({ ProjectTree::currentProject() }, dd->queue({ ProjectTree::currentProject() },
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) }); { Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_rebuildDependenciesActionContextMenu, &QAction::triggered, dd, [this] { connect(dd->m_rebuildDependenciesActionContextMenu, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()), dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()),
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) }); { Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_rebuildSessionAction, &QAction::triggered, dd, [this] { connect(dd->m_rebuildSessionAction, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(), dd->queue(SessionManager::projectOrder(),
{ Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) }); { Id(Constants::BUILDSTEPS_CLEAN), Id(Constants::BUILDSTEPS_BUILD) });
}); });
connect(dd->m_deployProjectOnlyAction, &QAction::triggered, dd, [this] { connect(dd->m_deployProjectOnlyAction, &QAction::triggered, dd, [] {
dd->deploy({ SessionManager::startupProject() }); dd->deploy({ SessionManager::startupProject() });
}); });
connect(dd->m_deployAction, &QAction::triggered, dd, [this] { connect(dd->m_deployAction, &QAction::triggered, dd, [] {
dd->deploy(SessionManager::projectOrder(SessionManager::startupProject())); dd->deploy(SessionManager::projectOrder(SessionManager::startupProject()));
}); });
connect(dd->m_deployActionContextMenu, &QAction::triggered, dd, [this] { connect(dd->m_deployActionContextMenu, &QAction::triggered, dd, [] {
dd->deploy({ ProjectTree::currentProject() }); dd->deploy({ ProjectTree::currentProject() });
}); });
connect(dd->m_deploySessionAction, &QAction::triggered, dd, [this] { connect(dd->m_deploySessionAction, &QAction::triggered, dd, [] {
dd->deploy(SessionManager::projectOrder()); dd->deploy(SessionManager::projectOrder());
}); });
connect(dd->m_cleanProjectOnlyAction, &QAction::triggered, dd, [this] { connect(dd->m_cleanProjectOnlyAction, &QAction::triggered, dd, [] {
dd->queue({ SessionManager::startupProject() }, { Id(Constants::BUILDSTEPS_CLEAN) }); dd->queue({ SessionManager::startupProject() }, { Id(Constants::BUILDSTEPS_CLEAN) });
}); });
connect(dd->m_cleanAction, &QAction::triggered, dd, [this] { connect(dd->m_cleanAction, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(SessionManager::startupProject()), dd->queue(SessionManager::projectOrder(SessionManager::startupProject()),
{ Id(Constants::BUILDSTEPS_CLEAN) }); { Id(Constants::BUILDSTEPS_CLEAN) });
}); });
connect(dd->m_cleanActionContextMenu, &QAction::triggered, dd, [this] { connect(dd->m_cleanActionContextMenu, &QAction::triggered, dd, [] {
dd->queue({ ProjectTree::currentProject() }, { Id(Constants::BUILDSTEPS_CLEAN) }); dd->queue({ ProjectTree::currentProject() }, { Id(Constants::BUILDSTEPS_CLEAN) });
}); });
connect(dd->m_cleanDependenciesActionContextMenu, &QAction::triggered, dd, [this] { connect(dd->m_cleanDependenciesActionContextMenu, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()), dd->queue(SessionManager::projectOrder(ProjectTree::currentProject()),
{ Id(Constants::BUILDSTEPS_CLEAN) }); { Id(Constants::BUILDSTEPS_CLEAN) });
}); });
connect(dd->m_cleanSessionAction, &QAction::triggered, dd, [this] { connect(dd->m_cleanSessionAction, &QAction::triggered, dd, [] {
dd->queue(SessionManager::projectOrder(), { Id(Constants::BUILDSTEPS_CLEAN) }); dd->queue(SessionManager::projectOrder(), { Id(Constants::BUILDSTEPS_CLEAN) });
}); });
connect(dd->m_runAction, &QAction::triggered, connect(dd->m_runAction, &QAction::triggered,
dd, [this]() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE); }); dd, []() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE); });
connect(dd->m_runActionContextMenu, &QAction::triggered, connect(dd->m_runActionContextMenu, &QAction::triggered,
dd, &ProjectExplorerPluginPrivate::runProjectContextMenu); dd, &ProjectExplorerPluginPrivate::runProjectContextMenu);
connect(dd->m_runWithoutDeployAction, &QAction::triggered, connect(dd->m_runWithoutDeployAction, &QAction::triggered,
dd, [this]() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE, true); }); dd, []() { m_instance->runStartupProject(Constants::NORMAL_RUN_MODE, true); });
connect(dd->m_cancelBuildAction, &QAction::triggered, connect(dd->m_cancelBuildAction, &QAction::triggered,
BuildManager::instance(), &BuildManager::cancel); BuildManager::instance(), &BuildManager::cancel);
connect(dd->m_unloadAction, &QAction::triggered, connect(dd->m_unloadAction, &QAction::triggered,
@@ -1397,7 +1395,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
Utils::MacroExpander *expander = Utils::globalMacroExpander(); Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX, expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
tr("Current project's main file."), tr("Current project's main file."),
[this]() -> QString { []() -> QString {
Utils::FileName projectFilePath; Utils::FileName projectFilePath;
if (Project *project = ProjectTree::currentProject()) if (Project *project = ProjectTree::currentProject())
projectFilePath = project->projectFilePath(); projectFilePath = project->projectFilePath();
@@ -1413,7 +1411,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME, expander->registerVariable(Constants::VAR_CURRENTPROJECT_NAME,
tr("The name of the current project."), tr("The name of the current project."),
[this]() -> QString { []() -> QString {
Project *project = ProjectTree::currentProject(); Project *project = ProjectTree::currentProject();
return project ? project->displayName() : QString(); return project ? project->displayName() : QString();
}); });
@@ -1482,7 +1480,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME, expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
tr("The currently active run configuration's name."), tr("The currently active run configuration's name."),
[this]() -> QString { []() -> QString {
if (Target *target = activeTarget()) { if (Target *target = activeTarget()) {
if (RunConfiguration *rc = target->activeRunConfiguration()) if (RunConfiguration *rc = target->activeRunConfiguration())
return rc->displayName(); return rc->displayName();
@@ -1492,7 +1490,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
expander->registerFileVariables("CurrentRun:Executable", expander->registerFileVariables("CurrentRun:Executable",
tr("The currently active run configuration's executable (if applicable)."), tr("The currently active run configuration's executable (if applicable)."),
[this]() -> QString { []() -> QString {
if (Target *target = activeTarget()) { if (Target *target = activeTarget()) {
if (RunConfiguration *rc = target->activeRunConfiguration()) { if (RunConfiguration *rc = target->activeRunConfiguration()) {
if (rc->runnable().is<StandardRunnable>()) if (rc->runnable().is<StandardRunnable>())
@@ -1614,7 +1612,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
QStringList filterStrings; QStringList filterStrings;
auto factory = new IDocumentFactory; auto factory = new IDocumentFactory;
factory->setOpener([this](QString fileName) -> IDocument* { factory->setOpener([](QString fileName) -> IDocument* {
const QFileInfo fi(fileName); const QFileInfo fi(fileName);
if (fi.isDir()) if (fi.isDir())
fileName = FolderNavigationWidget::projectFilesInDirectory(fi.absoluteFilePath()).value(0, fileName); fileName = FolderNavigationWidget::projectFilesInDirectory(fi.absoluteFilePath()).value(0, fileName);

View File

@@ -395,7 +395,7 @@ QMimeData *FlatModel::mimeData(const QModelIndexList &indexes) const
WrapperNode *FlatModel::wrapperForNode(const Node *node) const WrapperNode *FlatModel::wrapperForNode(const Node *node) const
{ {
return findNonRootItem([this, node](WrapperNode *item) { return findNonRootItem([node](WrapperNode *item) {
return item->m_node == node; return item->m_node == node;
}); });
} }

View File

@@ -134,9 +134,9 @@ SessionManager::SessionManager(QObject *parent) : QObject(parent)
connect(this, &SessionManager::projectDisplayNameChanged, connect(this, &SessionManager::projectDisplayNameChanged,
EditorManager::instance(), &EditorManager::updateWindowTitles); EditorManager::instance(), &EditorManager::updateWindowTitles);
connect(EditorManager::instance(), &EditorManager::editorOpened, connect(EditorManager::instance(), &EditorManager::editorOpened,
[this] { markSessionFileDirty(); }); this, [] { markSessionFileDirty(); });
connect(EditorManager::instance(), &EditorManager::editorsClosed, connect(EditorManager::instance(), &EditorManager::editorsClosed,
[this] { markSessionFileDirty(); }); this, [] { markSessionFileDirty(); });
EditorManager::setWindowTitleAdditionHandler(&SessionManagerPrivate::windowTitleAddition); EditorManager::setWindowTitleAdditionHandler(&SessionManagerPrivate::windowTitleAddition);
EditorManager::setSessionTitleHandler(&SessionManagerPrivate::sessionTitle); EditorManager::setSessionTitleHandler(&SessionManagerPrivate::sessionTitle);

View File

@@ -423,7 +423,7 @@ public:
QAction *disableAction = menu->addAction(tr("Disable Kit \"%1\" for Project \"%2\"").arg(kitName, projectName)); QAction *disableAction = menu->addAction(tr("Disable Kit \"%1\" for Project \"%2\"").arg(kitName, projectName));
disableAction->setEnabled(m_kitId.isValid() && isEnabled()); disableAction->setEnabled(m_kitId.isValid() && isEnabled());
QObject::connect(disableAction, &QAction::triggered, [this, kit] { QObject::connect(disableAction, &QAction::triggered, m_project, [this] {
Target *t = target(); Target *t = target();
QTC_ASSERT(t, return); QTC_ASSERT(t, return);
QString kitName = t->displayName(); QString kitName = t->displayName();
@@ -767,7 +767,7 @@ TargetItem *TargetGroupItem::targetItem(Target *target) const
{ {
if (target) { if (target) {
Id needle = target->id(); // Unconfigured project have no active target. Id needle = target->id(); // Unconfigured project have no active target.
return findFirstLevelChild([this, needle](TargetItem *item) { return item->m_kitId == needle; }); return findFirstLevelChild([needle](TargetItem *item) { return item->m_kitId == needle; });
} }
return 0; return 0;
} }

View File

@@ -85,7 +85,8 @@ void QmakeKitInformation::setup(Kit *k)
ToolChain *tc = ToolChainKitInformation::toolChain(k, Constants::CXX_LANGUAGE_ID); ToolChain *tc = ToolChainKitInformation::toolChain(k, Constants::CXX_LANGUAGE_ID);
if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) { if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) {
const QList<ToolChain *> possibleTcs = ToolChainManager::toolChains([version, &spec](const ToolChain *t) { const QList<ToolChain *> possibleTcs = ToolChainManager::toolChains(
[version](const ToolChain *t) {
return t->isValid() return t->isValid()
&& t->language() == Core::Id(Constants::CXX_LANGUAGE_ID) && t->language() == Core::Id(Constants::CXX_LANGUAGE_ID)
&& version->qtAbis().contains(t->targetAbi()); && version->qtAbis().contains(t->targetAbi());
@@ -113,7 +114,7 @@ KitInformation::ItemList QmakeKitInformation::toUserOutput(const Kit *k) const
void QmakeKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const void QmakeKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const
{ {
expander->registerVariable("Qmake:mkspec", tr("Mkspec configured for qmake by the Kit."), expander->registerVariable("Qmake:mkspec", tr("Mkspec configured for qmake by the Kit."),
[this, kit]() -> QString { [kit]() -> QString {
return QmakeKitInformation::mkspec(kit).toUserOutput(); return QmakeKitInformation::mkspec(kit).toUserOutput();
}); });
} }

View File

@@ -98,7 +98,7 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
this, &QmakeProjectConfigWidget::shadowBuildEdited); this, &QmakeProjectConfigWidget::shadowBuildEdited);
QmakeProject *project = static_cast<QmakeProject *>(bc->target()->project()); QmakeProject *project = static_cast<QmakeProject *>(bc->target()->project());
project->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this, bc]() { project->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this]() {
if (static_cast<BuildConfiguration *>(sender())->isActive()) if (static_cast<BuildConfiguration *>(sender())->isActive())
environmentChanged(); environmentChanged();
}); });

View File

@@ -92,7 +92,7 @@ QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
connect(comboBox, connect(comboBox,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
this, this,
[comboBox, this](const QString &style) { [this](const QString &style) {
if (style.isEmpty()) if (style.isEmpty())
return; return;

View File

@@ -55,7 +55,7 @@ OpenUiQmlFileDialog::OpenUiQmlFileDialog(QWidget *parent) :
} }
close(); close();
}); });
connect(ui->checkBox, &QCheckBox::toggled, [this](bool b){ connect(ui->checkBox, &QCheckBox::toggled, this, [](bool b){
DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); DesignerSettings settings = QmlDesignerPlugin::instance()->settings();
settings.insert(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES, !b); settings.insert(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES, !b);
QmlDesignerPlugin::instance()->setSettings(settings); QmlDesignerPlugin::instance()->setSettings(settings);

View File

@@ -175,7 +175,7 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
//Close All Others Action //Close All Others Action
Core::ActionManager::registerAction(&m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext); Core::ActionManager::registerAction(&m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext);
connect(&m_closeOtherEditorsAction, &QAction::triggered, em, [em] { connect(&m_closeOtherEditorsAction, &QAction::triggered, em, [] {
Core::EditorManager::closeOtherDocuments(); Core::EditorManager::closeOtherDocuments();
}); });

View File

@@ -554,12 +554,12 @@ void QmlProfilerModelManager::save(const QString &filename)
emit error(message); emit error(message);
}, Qt::QueuedConnection); }, Qt::QueuedConnection);
connect(writer, &QmlProfilerFileWriter::success, this, [this, file]() { connect(writer, &QmlProfilerFileWriter::success, this, [file]() {
file->close(); file->close();
delete file; delete file;
}, Qt::QueuedConnection); }, Qt::QueuedConnection);
connect(writer, &QmlProfilerFileWriter::canceled, this, [this, file]() { connect(writer, &QmlProfilerFileWriter::canceled, this, [file]() {
file->close(); file->close();
file->remove(); file->remove();
delete file; delete file;

View File

@@ -104,7 +104,7 @@ void QmlProfilerPlugin::extensionsInitialized()
}; };
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
[this](RunControl *runControl) { return new QmlProfilerRunner(runControl); }); [](RunControl *runControl) { return new QmlProfilerRunner(runControl); });
RunControl::registerWorker<LocalQmlProfilerSupport> RunControl::registerWorker<LocalQmlProfilerSupport>
(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint); (ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint);

View File

@@ -126,18 +126,18 @@ ProjectExplorer::IOutputParser *QtKitInformation::createOutputParser(const Proje
void QtKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const void QtKitInformation::addToMacroExpander(Kit *kit, MacroExpander *expander) const
{ {
expander->registerSubProvider( expander->registerSubProvider(
[this, kit]() -> MacroExpander * { [kit]() -> MacroExpander * {
BaseQtVersion *version = qtVersion(kit); BaseQtVersion *version = qtVersion(kit);
return version ? version->macroExpander() : 0; return version ? version->macroExpander() : 0;
}); });
expander->registerVariable("Qt:Name", tr("Name of Qt Version"), expander->registerVariable("Qt:Name", tr("Name of Qt Version"),
[this, kit]() -> QString { [kit]() -> QString {
BaseQtVersion *version = qtVersion(kit); BaseQtVersion *version = qtVersion(kit);
return version ? version->displayName() : tr("unknown"); return version ? version->displayName() : tr("unknown");
}); });
expander->registerVariable("Qt:qmakeExecutable", tr("Path to the qmake executable"), expander->registerVariable("Qt:qmakeExecutable", tr("Path to the qmake executable"),
[this, kit]() -> QString { [kit]() -> QString {
BaseQtVersion *version = qtVersion(kit); BaseQtVersion *version = qtVersion(kit);
return version ? version->qmakeCommand().toString() : QString(); return version ? version->qmakeCommand().toString() : QString();
}); });

View File

@@ -248,7 +248,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
} }
case IAssistProvider::Asynchronous: { case IAssistProvider::Asynchronous: {
processor->setAsyncCompletionAvailableHandler( processor->setAsyncCompletionAvailableHandler(
[this, processor, reason](IAssistProposal *newProposal){ [this, reason](IAssistProposal *newProposal){
QTC_CHECK(newProposal); QTC_CHECK(newProposal);
invalidateCurrentRequestData(); invalidateCurrentRequestData();
displayProposal(newProposal, reason); displayProposal(newProposal, reason);

View File

@@ -214,18 +214,18 @@ void TextEditorActionHandlerPrivate::createActions()
using namespace TextEditor::Constants; using namespace TextEditor::Constants;
m_undoAction = registerAction(UNDO, m_undoAction = registerAction(UNDO,
[this] (TextEditorWidget *w) { w->undo(); }, true, tr("&Undo")); [] (TextEditorWidget *w) { w->undo(); }, true, tr("&Undo"));
m_redoAction = registerAction(REDO, m_redoAction = registerAction(REDO,
[this] (TextEditorWidget *w) { w->redo(); }, true, tr("&Redo")); [] (TextEditorWidget *w) { w->redo(); }, true, tr("&Redo"));
m_copyAction = registerAction(COPY, m_copyAction = registerAction(COPY,
[this] (TextEditorWidget *w) { w->copy(); }, true); [] (TextEditorWidget *w) { w->copy(); }, true);
m_cutAction = registerAction(CUT, m_cutAction = registerAction(CUT,
[this] (TextEditorWidget *w) { w->cut(); }, true); [] (TextEditorWidget *w) { w->cut(); }, true);
m_pasteAction = registerAction(PASTE, m_pasteAction = registerAction(PASTE,
[this] (TextEditorWidget *w) { w->paste(); }, true); [] (TextEditorWidget *w) { w->paste(); }, true);
m_selectAllAction = registerAction(SELECTALL, m_selectAllAction = registerAction(SELECTALL,
[this] (TextEditorWidget *w) { w->selectAll(); }, true); [] (TextEditorWidget *w) { w->selectAll(); }, true);
m_gotoAction = registerAction(GOTO, [this] (TextEditorWidget *) { m_gotoAction = registerAction(GOTO, [] (TextEditorWidget *) {
QString locatorString = TextEditorPlugin::lineNumberFilter()->shortcutString(); QString locatorString = TextEditorPlugin::lineNumberFilter()->shortcutString();
locatorString += QLatin1Char(' '); locatorString += QLatin1Char(' ');
const int selectionStart = locatorString.size(); const int selectionStart = locatorString.size();
@@ -233,101 +233,101 @@ void TextEditorActionHandlerPrivate::createActions()
Core::LocatorManager::show(locatorString, selectionStart, locatorString.size() - selectionStart); Core::LocatorManager::show(locatorString, selectionStart, locatorString.size() - selectionStart);
}); });
m_printAction = registerAction(PRINT, m_printAction = registerAction(PRINT,
[this] (TextEditorWidget *widget) { widget->print(Core::ICore::printer()); }); [] (TextEditorWidget *widget) { widget->print(Core::ICore::printer()); });
m_deleteLineAction = registerAction(DELETE_LINE, m_deleteLineAction = registerAction(DELETE_LINE,
[this] (TextEditorWidget *w) { w->deleteLine(); }, true, tr("Delete &Line")); [] (TextEditorWidget *w) { w->deleteLine(); }, true, tr("Delete &Line"));
m_deleteEndOfLineAction = registerAction(DELETE_END_OF_LINE, m_deleteEndOfLineAction = registerAction(DELETE_END_OF_LINE,
[this] (TextEditorWidget *w) { w->deleteEndOfLine(); }, true, tr("Delete Line from Cursor On")); [] (TextEditorWidget *w) { w->deleteEndOfLine(); }, true, tr("Delete Line from Cursor On"));
m_deleteEndOfWordAction = registerAction(DELETE_END_OF_WORD, m_deleteEndOfWordAction = registerAction(DELETE_END_OF_WORD,
[this] (TextEditorWidget *w) { w->deleteEndOfWord(); }, true, tr("Delete Word from Cursor On")); [] (TextEditorWidget *w) { w->deleteEndOfWord(); }, true, tr("Delete Word from Cursor On"));
m_deleteEndOfWordCamelCaseAction = registerAction(DELETE_END_OF_WORD_CAMEL_CASE, m_deleteEndOfWordCamelCaseAction = registerAction(DELETE_END_OF_WORD_CAMEL_CASE,
[this] (TextEditorWidget *w) { w->deleteEndOfWordCamelCase(); }, true, tr("Delete Word Camel Case from Cursor On")); [] (TextEditorWidget *w) { w->deleteEndOfWordCamelCase(); }, true, tr("Delete Word Camel Case from Cursor On"));
m_deleteStartOfLineAction = registerAction(DELETE_START_OF_LINE, m_deleteStartOfLineAction = registerAction(DELETE_START_OF_LINE,
[this] (TextEditorWidget *w) { w->deleteStartOfLine(); }, true, tr("Delete Line up to Cursor")); [] (TextEditorWidget *w) { w->deleteStartOfLine(); }, true, tr("Delete Line up to Cursor"));
m_deleteStartOfWordAction = registerAction(DELETE_START_OF_WORD, m_deleteStartOfWordAction = registerAction(DELETE_START_OF_WORD,
[this] (TextEditorWidget *w) { w->deleteStartOfWord(); }, true, tr("Delete Word up to Cursor")); [] (TextEditorWidget *w) { w->deleteStartOfWord(); }, true, tr("Delete Word up to Cursor"));
m_deleteStartOfWordCamelCaseAction = registerAction(DELETE_START_OF_WORD_CAMEL_CASE, m_deleteStartOfWordCamelCaseAction = registerAction(DELETE_START_OF_WORD_CAMEL_CASE,
[this] (TextEditorWidget *w) { w->deleteStartOfWordCamelCase(); }, true, tr("Delete Word Camel Case up to Cursor")); [] (TextEditorWidget *w) { w->deleteStartOfWordCamelCase(); }, true, tr("Delete Word Camel Case up to Cursor"));
m_gotoBlockStartWithSelectionAction = registerAction(GOTO_BLOCK_START_WITH_SELECTION, m_gotoBlockStartWithSelectionAction = registerAction(GOTO_BLOCK_START_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoBlockStartWithSelection(); }, true, tr("Go to Block Start with Selection"), [] (TextEditorWidget *w) { w->gotoBlockStartWithSelection(); }, true, tr("Go to Block Start with Selection"),
QKeySequence(tr("Ctrl+{"))); QKeySequence(tr("Ctrl+{")));
m_gotoBlockEndWithSelectionAction = registerAction(GOTO_BLOCK_END_WITH_SELECTION, m_gotoBlockEndWithSelectionAction = registerAction(GOTO_BLOCK_END_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoBlockEndWithSelection(); }, true, tr("Go to Block End with Selection"), [] (TextEditorWidget *w) { w->gotoBlockEndWithSelection(); }, true, tr("Go to Block End with Selection"),
QKeySequence(tr("Ctrl+}"))); QKeySequence(tr("Ctrl+}")));
m_moveLineUpAction = registerAction(MOVE_LINE_UP, m_moveLineUpAction = registerAction(MOVE_LINE_UP,
[this] (TextEditorWidget *w) { w->moveLineUp(); }, true, tr("Move Line Up"), [] (TextEditorWidget *w) { w->moveLineUp(); }, true, tr("Move Line Up"),
QKeySequence(tr("Ctrl+Shift+Up"))); QKeySequence(tr("Ctrl+Shift+Up")));
m_moveLineDownAction = registerAction(MOVE_LINE_DOWN, m_moveLineDownAction = registerAction(MOVE_LINE_DOWN,
[this] (TextEditorWidget *w) { w->moveLineDown(); }, true, tr("Move Line Down"), [] (TextEditorWidget *w) { w->moveLineDown(); }, true, tr("Move Line Down"),
QKeySequence(tr("Ctrl+Shift+Down"))); QKeySequence(tr("Ctrl+Shift+Down")));
m_copyLineUpAction = registerAction(COPY_LINE_UP, m_copyLineUpAction = registerAction(COPY_LINE_UP,
[this] (TextEditorWidget *w) { w->copyLineUp(); }, true, tr("Copy Line Up"), [] (TextEditorWidget *w) { w->copyLineUp(); }, true, tr("Copy Line Up"),
QKeySequence(tr("Ctrl+Alt+Up"))); QKeySequence(tr("Ctrl+Alt+Up")));
m_copyLineDownAction = registerAction(COPY_LINE_DOWN, m_copyLineDownAction = registerAction(COPY_LINE_DOWN,
[this] (TextEditorWidget *w) { w->copyLineDown(); }, true, tr("Copy Line Down"), [] (TextEditorWidget *w) { w->copyLineDown(); }, true, tr("Copy Line Down"),
QKeySequence(tr("Ctrl+Alt+Down"))); QKeySequence(tr("Ctrl+Alt+Down")));
m_joinLinesAction = registerAction(JOIN_LINES, m_joinLinesAction = registerAction(JOIN_LINES,
[this] (TextEditorWidget *w) { w->joinLines(); }, true, tr("Join Lines"), [] (TextEditorWidget *w) { w->joinLines(); }, true, tr("Join Lines"),
QKeySequence(tr("Ctrl+J"))); QKeySequence(tr("Ctrl+J")));
m_insertLineAboveAction = registerAction(INSERT_LINE_ABOVE, m_insertLineAboveAction = registerAction(INSERT_LINE_ABOVE,
[this] (TextEditorWidget *w) { w->insertLineAbove(); }, true, tr("Insert Line Above Current Line"), [] (TextEditorWidget *w) { w->insertLineAbove(); }, true, tr("Insert Line Above Current Line"),
QKeySequence(tr("Ctrl+Shift+Return"))); QKeySequence(tr("Ctrl+Shift+Return")));
m_insertLineBelowAction = registerAction(INSERT_LINE_BELOW, m_insertLineBelowAction = registerAction(INSERT_LINE_BELOW,
[this] (TextEditorWidget *w) { w->insertLineBelow(); }, true, tr("Insert Line Below Current Line"), [] (TextEditorWidget *w) { w->insertLineBelow(); }, true, tr("Insert Line Below Current Line"),
QKeySequence(tr("Ctrl+Return"))); QKeySequence(tr("Ctrl+Return")));
m_switchUtf8bomAction = registerAction(SWITCH_UTF8BOM, m_switchUtf8bomAction = registerAction(SWITCH_UTF8BOM,
[this] (TextEditorWidget *w) { w->switchUtf8bom(); }, true, tr("Toggle UTF-8 BOM")); [] (TextEditorWidget *w) { w->switchUtf8bom(); }, true, tr("Toggle UTF-8 BOM"));
m_indentAction = registerAction(INDENT, m_indentAction = registerAction(INDENT,
[this] (TextEditorWidget *w) { w->indent(); }, true, tr("Indent")); [] (TextEditorWidget *w) { w->indent(); }, true, tr("Indent"));
m_unindentAction = registerAction(UNINDENT, m_unindentAction = registerAction(UNINDENT,
[this] (TextEditorWidget *w) { w->unindent(); }, true, tr("Unindent")); [] (TextEditorWidget *w) { w->unindent(); }, true, tr("Unindent"));
m_followSymbolAction = registerAction(FOLLOW_SYMBOL_UNDER_CURSOR, m_followSymbolAction = registerAction(FOLLOW_SYMBOL_UNDER_CURSOR,
[this] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, tr("Follow Symbol Under Cursor"), [] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, tr("Follow Symbol Under Cursor"),
QKeySequence(Qt::Key_F2)); QKeySequence(Qt::Key_F2));
m_followSymbolInNextSplitAction = registerAction(FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT, m_followSymbolInNextSplitAction = registerAction(FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT,
[this] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, tr("Follow Symbol Under Cursor in Next Split"), [] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, tr("Follow Symbol Under Cursor in Next Split"),
QKeySequence(Utils::HostOsInfo::isMacHost() ? tr("Meta+E, F2") : tr("Ctrl+E, F2"))); QKeySequence(Utils::HostOsInfo::isMacHost() ? tr("Meta+E, F2") : tr("Ctrl+E, F2")));
m_jumpToFileAction = registerAction(JUMP_TO_FILE_UNDER_CURSOR, m_jumpToFileAction = registerAction(JUMP_TO_FILE_UNDER_CURSOR,
[this] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, tr("Jump to File Under Cursor"), [] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, tr("Jump to File Under Cursor"),
QKeySequence(Qt::Key_F2)); QKeySequence(Qt::Key_F2));
m_jumpToFileInNextSplitAction = registerAction(JUMP_TO_FILE_UNDER_CURSOR_IN_NEXT_SPLIT, m_jumpToFileInNextSplitAction = registerAction(JUMP_TO_FILE_UNDER_CURSOR_IN_NEXT_SPLIT,
[this] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, tr("Jump to File Under Cursor in Next Split"), [] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, tr("Jump to File Under Cursor in Next Split"),
QKeySequence(Utils::HostOsInfo::isMacHost() ? tr("Meta+E, F2") : tr("Ctrl+E, F2")).toString()); QKeySequence(Utils::HostOsInfo::isMacHost() ? tr("Meta+E, F2") : tr("Ctrl+E, F2")).toString());
m_viewPageUpAction = registerAction(VIEW_PAGE_UP, m_viewPageUpAction = registerAction(VIEW_PAGE_UP,
[this] (TextEditorWidget *w) { w->viewPageUp(); }, true, tr("Move the View a Page Up and Keep the Cursor Position"), [] (TextEditorWidget *w) { w->viewPageUp(); }, true, tr("Move the View a Page Up and Keep the Cursor Position"),
QKeySequence(tr("Ctrl+PgUp"))); QKeySequence(tr("Ctrl+PgUp")));
m_viewPageDownAction = registerAction(VIEW_PAGE_DOWN, m_viewPageDownAction = registerAction(VIEW_PAGE_DOWN,
[this] (TextEditorWidget *w) { w->viewPageDown(); }, true, tr("Move the View a Page Down and Keep the Cursor Position"), [] (TextEditorWidget *w) { w->viewPageDown(); }, true, tr("Move the View a Page Down and Keep the Cursor Position"),
QKeySequence(tr("Ctrl+PgDown"))); QKeySequence(tr("Ctrl+PgDown")));
m_viewLineUpAction = registerAction(VIEW_LINE_UP, m_viewLineUpAction = registerAction(VIEW_LINE_UP,
[this] (TextEditorWidget *w) { w->viewLineUp(); }, true, tr("Move the View a Line Up and Keep the Cursor Position"), [] (TextEditorWidget *w) { w->viewLineUp(); }, true, tr("Move the View a Line Up and Keep the Cursor Position"),
QKeySequence(tr("Ctrl+Up"))); QKeySequence(tr("Ctrl+Up")));
m_viewLineDownAction = registerAction(VIEW_LINE_DOWN, m_viewLineDownAction = registerAction(VIEW_LINE_DOWN,
[this] (TextEditorWidget *w) { w->viewLineDown(); }, true, tr("Move the View a Line Down and Keep the Cursor Position"), [] (TextEditorWidget *w) { w->viewLineDown(); }, true, tr("Move the View a Line Down and Keep the Cursor Position"),
QKeySequence(tr("Ctrl+Down"))); QKeySequence(tr("Ctrl+Down")));
// register "Edit" Menu Actions // register "Edit" Menu Actions
Core::ActionContainer *editMenu = Core::ActionManager::actionContainer(M_EDIT); Core::ActionContainer *editMenu = Core::ActionManager::actionContainer(M_EDIT);
m_selectEncodingAction = registerAction(SELECT_ENCODING, m_selectEncodingAction = registerAction(SELECT_ENCODING,
[this] (TextEditorWidget *w) { w->selectEncoding(); }, false, tr("Select Encoding..."), [] (TextEditorWidget *w) { w->selectEncoding(); }, false, tr("Select Encoding..."),
QKeySequence(), G_EDIT_OTHER, editMenu); QKeySequence(), G_EDIT_OTHER, editMenu);
m_circularPasteAction = registerAction(CIRCULAR_PASTE, m_circularPasteAction = registerAction(CIRCULAR_PASTE,
[this] (TextEditorWidget *w) { w->circularPaste(); }, false, tr("Paste from Clipboard History"), [] (TextEditorWidget *w) { w->circularPaste(); }, false, tr("Paste from Clipboard History"),
QKeySequence(tr("Ctrl+Shift+V")), G_EDIT_COPYPASTE, editMenu); QKeySequence(tr("Ctrl+Shift+V")), G_EDIT_COPYPASTE, editMenu);
// register "Edit -> Advanced" Menu Actions // register "Edit -> Advanced" Menu Actions
Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED); Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED);
m_formatAction = registerAction(AUTO_INDENT_SELECTION, m_formatAction = registerAction(AUTO_INDENT_SELECTION,
[this] (TextEditorWidget *w) { w->format(); }, true, tr("Auto-&indent Selection"), [] (TextEditorWidget *w) { w->format(); }, true, tr("Auto-&indent Selection"),
QKeySequence(tr("Ctrl+I")), QKeySequence(tr("Ctrl+I")),
G_EDIT_FORMAT, advancedEditMenu); G_EDIT_FORMAT, advancedEditMenu);
m_rewrapParagraphAction = registerAction(REWRAP_PARAGRAPH, m_rewrapParagraphAction = registerAction(REWRAP_PARAGRAPH,
[this] (TextEditorWidget *w) { w->rewrapParagraph(); }, true, tr("&Rewrap Paragraph"), [] (TextEditorWidget *w) { w->rewrapParagraph(); }, true, tr("&Rewrap Paragraph"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, R") : tr("Ctrl+E, R")), QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, R") : tr("Ctrl+E, R")),
G_EDIT_FORMAT, advancedEditMenu); G_EDIT_FORMAT, advancedEditMenu);
m_visualizeWhitespaceAction = registerBoolAction(VISUALIZE_WHITESPACE, m_visualizeWhitespaceAction = registerBoolAction(VISUALIZE_WHITESPACE,
[this] (TextEditorWidget *widget, bool checked) { [] (TextEditorWidget *widget, bool checked) {
if (widget) { if (widget) {
DisplaySettings ds = widget->displaySettings(); DisplaySettings ds = widget->displaySettings();
ds.m_visualizeWhitespace = checked; ds.m_visualizeWhitespace = checked;
@@ -339,11 +339,11 @@ void TextEditorActionHandlerPrivate::createActions()
G_EDIT_FORMAT, advancedEditMenu); G_EDIT_FORMAT, advancedEditMenu);
m_visualizeWhitespaceAction->setCheckable(true); m_visualizeWhitespaceAction->setCheckable(true);
m_cleanWhitespaceAction = registerAction(CLEAN_WHITESPACE, m_cleanWhitespaceAction = registerAction(CLEAN_WHITESPACE,
[this] (TextEditorWidget *w) { w->cleanWhitespace(); }, true, tr("Clean Whitespace"), [] (TextEditorWidget *w) { w->cleanWhitespace(); }, true, tr("Clean Whitespace"),
QKeySequence(), QKeySequence(),
G_EDIT_FORMAT, advancedEditMenu); G_EDIT_FORMAT, advancedEditMenu);
m_textWrappingAction = registerBoolAction(TEXT_WRAPPING, m_textWrappingAction = registerBoolAction(TEXT_WRAPPING,
[this] (TextEditorWidget *widget, bool checked) { [] (TextEditorWidget *widget, bool checked) {
if (widget) { if (widget) {
DisplaySettings ds = widget->displaySettings(); DisplaySettings ds = widget->displaySettings();
ds.m_textWrapping = checked; ds.m_textWrapping = checked;
@@ -355,120 +355,120 @@ void TextEditorActionHandlerPrivate::createActions()
G_EDIT_FORMAT, advancedEditMenu); G_EDIT_FORMAT, advancedEditMenu);
m_textWrappingAction->setCheckable(true); m_textWrappingAction->setCheckable(true);
m_unCommentSelectionAction = registerAction(UN_COMMENT_SELECTION, m_unCommentSelectionAction = registerAction(UN_COMMENT_SELECTION,
[this] (TextEditorWidget *w) { w->unCommentSelection(); }, true, tr("Toggle Comment &Selection"), [] (TextEditorWidget *w) { w->unCommentSelection(); }, true, tr("Toggle Comment &Selection"),
QKeySequence(tr("Ctrl+/")), QKeySequence(tr("Ctrl+/")),
G_EDIT_FORMAT, advancedEditMenu); G_EDIT_FORMAT, advancedEditMenu);
m_cutLineAction = registerAction(CUT_LINE, m_cutLineAction = registerAction(CUT_LINE,
[this] (TextEditorWidget *w) { w->cutLine(); }, true, tr("Cut &Line"), [] (TextEditorWidget *w) { w->cutLine(); }, true, tr("Cut &Line"),
QKeySequence(tr("Shift+Del")), QKeySequence(tr("Shift+Del")),
G_EDIT_TEXT, advancedEditMenu); G_EDIT_TEXT, advancedEditMenu);
m_copyLineAction = registerAction(COPY_LINE, m_copyLineAction = registerAction(COPY_LINE,
[this] (TextEditorWidget *w) { w->copyLine(); }, false, tr("Copy &Line"), [] (TextEditorWidget *w) { w->copyLine(); }, false, tr("Copy &Line"),
QKeySequence(tr("Ctrl+Ins")), QKeySequence(tr("Ctrl+Ins")),
G_EDIT_TEXT, advancedEditMenu); G_EDIT_TEXT, advancedEditMenu);
m_duplicateSelectionAction = registerAction(DUPLICATE_SELECTION, m_duplicateSelectionAction = registerAction(DUPLICATE_SELECTION,
[this] (TextEditorWidget *w) { w->duplicateSelection(); }, false, tr("&Duplicate Selection"), [] (TextEditorWidget *w) { w->duplicateSelection(); }, false, tr("&Duplicate Selection"),
QKeySequence(), QKeySequence(),
G_EDIT_TEXT, advancedEditMenu); G_EDIT_TEXT, advancedEditMenu);
m_duplicateSelectionAndCommentAction = registerAction(DUPLICATE_SELECTION_AND_COMMENT, m_duplicateSelectionAndCommentAction = registerAction(DUPLICATE_SELECTION_AND_COMMENT,
[this] (TextEditorWidget *w) { w->duplicateSelectionAndComment(); }, false, tr("&Duplicate Selection and Comment"), [] (TextEditorWidget *w) { w->duplicateSelectionAndComment(); }, false, tr("&Duplicate Selection and Comment"),
QKeySequence(), QKeySequence(),
G_EDIT_TEXT, advancedEditMenu); G_EDIT_TEXT, advancedEditMenu);
m_upperCaseSelectionAction = registerAction(UPPERCASE_SELECTION, m_upperCaseSelectionAction = registerAction(UPPERCASE_SELECTION,
[this] (TextEditorWidget *w) { w->uppercaseSelection(); }, true, tr("Uppercase Selection"), [] (TextEditorWidget *w) { w->uppercaseSelection(); }, true, tr("Uppercase Selection"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+U") : tr("Alt+Shift+U")), QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+U") : tr("Alt+Shift+U")),
G_EDIT_TEXT, advancedEditMenu); G_EDIT_TEXT, advancedEditMenu);
m_lowerCaseSelectionAction = registerAction(LOWERCASE_SELECTION, m_lowerCaseSelectionAction = registerAction(LOWERCASE_SELECTION,
[this] (TextEditorWidget *w) { w->lowercaseSelection(); }, true, tr("Lowercase Selection"), [] (TextEditorWidget *w) { w->lowercaseSelection(); }, true, tr("Lowercase Selection"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+U") : tr("Alt+U")), QKeySequence(Core::UseMacShortcuts ? tr("Meta+U") : tr("Alt+U")),
G_EDIT_TEXT, advancedEditMenu); G_EDIT_TEXT, advancedEditMenu);
m_foldAction = registerAction(FOLD, m_foldAction = registerAction(FOLD,
[this] (TextEditorWidget *w) { w->fold(); }, true, tr("Fold"), [] (TextEditorWidget *w) { w->fold(); }, true, tr("Fold"),
QKeySequence(tr("Ctrl+<")), QKeySequence(tr("Ctrl+<")),
G_EDIT_COLLAPSING, advancedEditMenu); G_EDIT_COLLAPSING, advancedEditMenu);
m_unfoldAction = registerAction(UNFOLD, m_unfoldAction = registerAction(UNFOLD,
[this] (TextEditorWidget *w) { w->unfold(); }, true, tr("Unfold"), [] (TextEditorWidget *w) { w->unfold(); }, true, tr("Unfold"),
QKeySequence(tr("Ctrl+>")), QKeySequence(tr("Ctrl+>")),
G_EDIT_COLLAPSING, advancedEditMenu); G_EDIT_COLLAPSING, advancedEditMenu);
m_unfoldAllAction = registerAction(UNFOLD_ALL, m_unfoldAllAction = registerAction(UNFOLD_ALL,
[this] (TextEditorWidget *w) { w->unfoldAll(); }, true, tr("Toggle &Fold All"), [] (TextEditorWidget *w) { w->unfoldAll(); }, true, tr("Toggle &Fold All"),
QKeySequence(), QKeySequence(),
G_EDIT_COLLAPSING, advancedEditMenu); G_EDIT_COLLAPSING, advancedEditMenu);
m_increaseFontSizeAction = registerAction(INCREASE_FONT_SIZE, m_increaseFontSizeAction = registerAction(INCREASE_FONT_SIZE,
[this] (TextEditorWidget *w) { w->zoomF(1.f); }, false, tr("Increase Font Size"), [] (TextEditorWidget *w) { w->zoomF(1.f); }, false, tr("Increase Font Size"),
QKeySequence(tr("Ctrl++")), QKeySequence(tr("Ctrl++")),
G_EDIT_FONT, advancedEditMenu); G_EDIT_FONT, advancedEditMenu);
m_decreaseFontSizeAction = registerAction(DECREASE_FONT_SIZE, m_decreaseFontSizeAction = registerAction(DECREASE_FONT_SIZE,
[this] (TextEditorWidget *w) { w->zoomF(-1.f); }, false, tr("Decrease Font Size"), [] (TextEditorWidget *w) { w->zoomF(-1.f); }, false, tr("Decrease Font Size"),
QKeySequence(tr("Ctrl+-")), QKeySequence(tr("Ctrl+-")),
G_EDIT_FONT, advancedEditMenu); G_EDIT_FONT, advancedEditMenu);
m_resetFontSizeAction = registerAction(RESET_FONT_SIZE, m_resetFontSizeAction = registerAction(RESET_FONT_SIZE,
[this] (TextEditorWidget *w) { w->zoomReset(); }, false, tr("Reset Font Size"), [] (TextEditorWidget *w) { w->zoomReset(); }, false, tr("Reset Font Size"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+0") : tr("Ctrl+0")), QKeySequence(Core::UseMacShortcuts ? tr("Meta+0") : tr("Ctrl+0")),
G_EDIT_FONT, advancedEditMenu); G_EDIT_FONT, advancedEditMenu);
m_gotoBlockStartAction = registerAction(GOTO_BLOCK_START, m_gotoBlockStartAction = registerAction(GOTO_BLOCK_START,
[this] (TextEditorWidget *w) { w->gotoBlockStart(); }, true, tr("Go to Block Start"), [] (TextEditorWidget *w) { w->gotoBlockStart(); }, true, tr("Go to Block Start"),
QKeySequence(tr("Ctrl+[")), QKeySequence(tr("Ctrl+[")),
G_EDIT_BLOCKS, advancedEditMenu); G_EDIT_BLOCKS, advancedEditMenu);
m_gotoBlockEndAction = registerAction(GOTO_BLOCK_END, m_gotoBlockEndAction = registerAction(GOTO_BLOCK_END,
[this] (TextEditorWidget *w) { w->gotoBlockEnd(); }, true, tr("Go to Block End"), [] (TextEditorWidget *w) { w->gotoBlockEnd(); }, true, tr("Go to Block End"),
QKeySequence(tr("Ctrl+]")), QKeySequence(tr("Ctrl+]")),
G_EDIT_BLOCKS, advancedEditMenu); G_EDIT_BLOCKS, advancedEditMenu);
m_selectBlockUpAction = registerAction(SELECT_BLOCK_UP, m_selectBlockUpAction = registerAction(SELECT_BLOCK_UP,
[this] (TextEditorWidget *w) { w->selectBlockUp(); }, true, tr("Select Block Up"), [] (TextEditorWidget *w) { w->selectBlockUp(); }, true, tr("Select Block Up"),
QKeySequence(tr("Ctrl+U")), QKeySequence(tr("Ctrl+U")),
G_EDIT_BLOCKS, advancedEditMenu); G_EDIT_BLOCKS, advancedEditMenu);
m_selectBlockDownAction = registerAction(SELECT_BLOCK_DOWN, m_selectBlockDownAction = registerAction(SELECT_BLOCK_DOWN,
[this] (TextEditorWidget *w) { w->selectBlockDown(); }, true, tr("Select Block Down"), [] (TextEditorWidget *w) { w->selectBlockDown(); }, true, tr("Select Block Down"),
QKeySequence(tr("Ctrl+Shift+Alt+U")), QKeySequence(tr("Ctrl+Shift+Alt+U")),
G_EDIT_BLOCKS, advancedEditMenu); G_EDIT_BLOCKS, advancedEditMenu);
registerAction(SELECT_WORD_UNDER_CURSOR, registerAction(SELECT_WORD_UNDER_CURSOR,
[this] (TextEditorWidget *w) { w->selectWordUnderCursor(); }, true, [] (TextEditorWidget *w) { w->selectWordUnderCursor(); }, true,
tr("Select Word Under Cursor")); tr("Select Word Under Cursor"));
// register GOTO Actions // register GOTO Actions
registerAction(GOTO_LINE_START, registerAction(GOTO_LINE_START,
[this] (TextEditorWidget *w) { w->gotoLineStart(); }, true, tr("Go to Line Start")); [] (TextEditorWidget *w) { w->gotoLineStart(); }, true, tr("Go to Line Start"));
registerAction(GOTO_LINE_END, registerAction(GOTO_LINE_END,
[this] (TextEditorWidget *w) { w->gotoLineEnd(); }, true, tr("Go to Line End")); [] (TextEditorWidget *w) { w->gotoLineEnd(); }, true, tr("Go to Line End"));
registerAction(GOTO_NEXT_LINE, registerAction(GOTO_NEXT_LINE,
[this] (TextEditorWidget *w) { w->gotoNextLine(); }, true, tr("Go to Next Line")); [] (TextEditorWidget *w) { w->gotoNextLine(); }, true, tr("Go to Next Line"));
registerAction(GOTO_PREVIOUS_LINE, registerAction(GOTO_PREVIOUS_LINE,
[this] (TextEditorWidget *w) { w->gotoPreviousLine(); }, true, tr("Go to Previous Line")); [] (TextEditorWidget *w) { w->gotoPreviousLine(); }, true, tr("Go to Previous Line"));
registerAction(GOTO_PREVIOUS_CHARACTER, registerAction(GOTO_PREVIOUS_CHARACTER,
[this] (TextEditorWidget *w) { w->gotoPreviousCharacter(); }, true, tr("Go to Previous Character")); [] (TextEditorWidget *w) { w->gotoPreviousCharacter(); }, true, tr("Go to Previous Character"));
registerAction(GOTO_NEXT_CHARACTER, registerAction(GOTO_NEXT_CHARACTER,
[this] (TextEditorWidget *w) { w->gotoNextCharacter(); }, true, tr("Go to Next Character")); [] (TextEditorWidget *w) { w->gotoNextCharacter(); }, true, tr("Go to Next Character"));
registerAction(GOTO_PREVIOUS_WORD, registerAction(GOTO_PREVIOUS_WORD,
[this] (TextEditorWidget *w) { w->gotoPreviousWord(); }, true, tr("Go to Previous Word")); [] (TextEditorWidget *w) { w->gotoPreviousWord(); }, true, tr("Go to Previous Word"));
registerAction(GOTO_NEXT_WORD, registerAction(GOTO_NEXT_WORD,
[this] (TextEditorWidget *w) { w->gotoNextWord(); }, true, tr("Go to Next Word")); [] (TextEditorWidget *w) { w->gotoNextWord(); }, true, tr("Go to Next Word"));
registerAction(GOTO_PREVIOUS_WORD_CAMEL_CASE, registerAction(GOTO_PREVIOUS_WORD_CAMEL_CASE,
[this] (TextEditorWidget *w) { w->gotoPreviousWordCamelCase(); }, false, tr("Go to Previous Word Camel Case")); [] (TextEditorWidget *w) { w->gotoPreviousWordCamelCase(); }, false, tr("Go to Previous Word Camel Case"));
registerAction(GOTO_NEXT_WORD_CAMEL_CASE, registerAction(GOTO_NEXT_WORD_CAMEL_CASE,
[this] (TextEditorWidget *w) { w->gotoNextWordCamelCase(); }, false, tr("Go to Next Word Camel Case")); [] (TextEditorWidget *w) { w->gotoNextWordCamelCase(); }, false, tr("Go to Next Word Camel Case"));
// register GOTO actions with selection // register GOTO actions with selection
registerAction(GOTO_LINE_START_WITH_SELECTION, registerAction(GOTO_LINE_START_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoLineStartWithSelection(); }, true, tr("Go to Line Start with Selection")); [] (TextEditorWidget *w) { w->gotoLineStartWithSelection(); }, true, tr("Go to Line Start with Selection"));
registerAction(GOTO_LINE_END_WITH_SELECTION, registerAction(GOTO_LINE_END_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoLineEndWithSelection(); }, true, tr("Go to Line End with Selection")); [] (TextEditorWidget *w) { w->gotoLineEndWithSelection(); }, true, tr("Go to Line End with Selection"));
registerAction(GOTO_NEXT_LINE_WITH_SELECTION, registerAction(GOTO_NEXT_LINE_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoNextLineWithSelection(); }, true, tr("Go to Next Line with Selection")); [] (TextEditorWidget *w) { w->gotoNextLineWithSelection(); }, true, tr("Go to Next Line with Selection"));
registerAction(GOTO_PREVIOUS_LINE_WITH_SELECTION, registerAction(GOTO_PREVIOUS_LINE_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoPreviousLineWithSelection(); }, true, tr("Go to Previous Line with Selection")); [] (TextEditorWidget *w) { w->gotoPreviousLineWithSelection(); }, true, tr("Go to Previous Line with Selection"));
registerAction(GOTO_PREVIOUS_CHARACTER_WITH_SELECTION, registerAction(GOTO_PREVIOUS_CHARACTER_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoPreviousCharacterWithSelection(); }, true, tr("Go to Previous Character with Selection")); [] (TextEditorWidget *w) { w->gotoPreviousCharacterWithSelection(); }, true, tr("Go to Previous Character with Selection"));
registerAction(GOTO_NEXT_CHARACTER_WITH_SELECTION, registerAction(GOTO_NEXT_CHARACTER_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoNextCharacterWithSelection(); }, true, tr("Go to Next Character with Selection")); [] (TextEditorWidget *w) { w->gotoNextCharacterWithSelection(); }, true, tr("Go to Next Character with Selection"));
registerAction(GOTO_PREVIOUS_WORD_WITH_SELECTION, registerAction(GOTO_PREVIOUS_WORD_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoPreviousWordWithSelection(); }, true, tr("Go to Previous Word with Selection")); [] (TextEditorWidget *w) { w->gotoPreviousWordWithSelection(); }, true, tr("Go to Previous Word with Selection"));
registerAction(GOTO_NEXT_WORD_WITH_SELECTION, registerAction(GOTO_NEXT_WORD_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoNextWordWithSelection(); }, true, tr("Go to Next Word with Selection")); [] (TextEditorWidget *w) { w->gotoNextWordWithSelection(); }, true, tr("Go to Next Word with Selection"));
registerAction(GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION, registerAction(GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoPreviousWordCamelCaseWithSelection(); }, false, tr("Go to Previous Word Camel Case with Selection")); [] (TextEditorWidget *w) { w->gotoPreviousWordCamelCaseWithSelection(); }, false, tr("Go to Previous Word Camel Case with Selection"));
registerAction(GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION, registerAction(GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION,
[this] (TextEditorWidget *w) { w->gotoNextWordCamelCaseWithSelection(); }, false, tr("Go to Next Word Camel Case with Selection")); [] (TextEditorWidget *w) { w->gotoNextWordCamelCaseWithSelection(); }, false, tr("Go to Next Word Camel Case with Selection"));
// Collect all modifying actions so we can check for them inside a readonly file // Collect all modifying actions so we can check for them inside a readonly file
// and disable them // and disable them

View File

@@ -71,7 +71,7 @@ bool TodoPlugin::initialize(const QStringList& args, QString *errMsg)
auto panelFactory = new ProjectExplorer::ProjectPanelFactory; auto panelFactory = new ProjectExplorer::ProjectPanelFactory;
panelFactory->setPriority(100); panelFactory->setPriority(100);
panelFactory->setDisplayName(TodoProjectSettingsWidget::tr("To-Do")); panelFactory->setDisplayName(TodoProjectSettingsWidget::tr("To-Do"));
panelFactory->setCreateWidgetFunction([this, panelFactory](ProjectExplorer::Project *project) { panelFactory->setCreateWidgetFunction([this](ProjectExplorer::Project *project) {
auto widget = new TodoProjectSettingsWidget(project); auto widget = new TodoProjectSettingsWidget(project);
connect(widget, &TodoProjectSettingsWidget::projectSettingsChanged, connect(widget, &TodoProjectSettingsWidget::projectSettingsChanged,
m_todoItemsProvider, [this, project] { m_todoItemsProvider->projectSettingsChanged(project); }); m_todoItemsProvider, [this, project] { m_todoItemsProvider->projectSettingsChanged(project); });

View File

@@ -434,7 +434,7 @@ MemcheckTool::MemcheckTool()
action->setToolTip(toolTip); action->setToolTip(toolTip);
menu->addAction(ActionManager::registerAction(action, "Memcheck.Remote"), menu->addAction(ActionManager::registerAction(action, "Memcheck.Remote"),
Debugger::Constants::G_ANALYZER_REMOTE_TOOLS); Debugger::Constants::G_ANALYZER_REMOTE_TOOLS);
QObject::connect(action, &QAction::triggered, this, [this, action] { QObject::connect(action, &QAction::triggered, this, [action] {
auto runConfig = RunConfiguration::startupRunConfiguration(); auto runConfig = RunConfiguration::startupRunConfiguration();
if (!runConfig) { if (!runConfig) {
showCannotStartDialog(action->text()); showCannotStartDialog(action->text());
@@ -583,7 +583,7 @@ RunWorker *MemcheckTool::createRunWorker(RunControl *runControl)
foreach (const QString &file, runTool->suppressionFiles()) { foreach (const QString &file, runTool->suppressionFiles()) {
QAction *action = m_filterMenu->addAction(Utils::FileName::fromString(file).fileName()); QAction *action = m_filterMenu->addAction(Utils::FileName::fromString(file).fileName());
action->setToolTip(file); action->setToolTip(file);
connect(action, &QAction::triggered, this, [this, file]() { connect(action, &QAction::triggered, this, [file]() {
Core::EditorManager::openEditorAt(file, 0); Core::EditorManager::openEditorAt(file, 0);
}); });
m_suppressionActions.append(action); m_suppressionActions.append(action);

View File

@@ -63,7 +63,7 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
setEditorActionHandlers(TextEditorActionHandler::None); setEditorActionHandlers(TextEditorActionHandler::None);
setDuplicatedSupported(false); setDuplicatedSupported(false);
setDocumentCreator([this, parameters]() -> TextDocument* { setDocumentCreator([parameters]() -> TextDocument* {
auto document = new TextDocument(parameters->id); auto document = new TextDocument(parameters->id);
// if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE)) // if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE))
document->setMimeType(QLatin1String(parameters->mimeType)); document->setMimeType(QLatin1String(parameters->mimeType));
@@ -71,7 +71,7 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
return document; return document;
}); });
setEditorWidgetCreator([this, parameters, editorWidgetCreator, describeFunc]() -> TextEditorWidget * { setEditorWidgetCreator([parameters, editorWidgetCreator, describeFunc]() -> TextEditorWidget * {
auto widget = qobject_cast<VcsBaseEditorWidget *>(editorWidgetCreator()); auto widget = qobject_cast<VcsBaseEditorWidget *>(editorWidgetCreator());
widget->setDescribeFunc(describeFunc); widget->setDescribeFunc(describeFunc);
widget->setParameters(parameters); widget->setParameters(parameters);

View File

@@ -74,9 +74,9 @@ VcsProjectCache::VcsProjectCache()
m_instance = this; m_instance = this;
connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::projectAdded, connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::projectAdded,
this, [this]() { VcsProjectCache::invalidate(); }); this, []() { VcsProjectCache::invalidate(); });
connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::projectRemoved, connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::projectRemoved,
this, [this]() { VcsProjectCache::invalidate(); }); this, []() { VcsProjectCache::invalidate(); });
} }
VcsProjectCache::~VcsProjectCache() VcsProjectCache::~VcsProjectCache()

View File

@@ -401,7 +401,7 @@ void WelcomeMode::addPage(IWelcomePage *page)
stackPage->setAutoFillBackground(true); stackPage->setAutoFillBackground(true);
m_pageStack->insertWidget(idx, stackPage); m_pageStack->insertWidget(idx, stackPage);
auto onClicked = [this, page, pageId, stackPage] { auto onClicked = [this, pageId, stackPage] {
m_activePage = pageId; m_activePage = pageId;
m_pageStack->setCurrentWidget(stackPage); m_pageStack->setCurrentWidget(stackPage);
for (WelcomePageButton *pageButton : m_pageButtons) for (WelcomePageButton *pageButton : m_pageButtons)