Debugger: Pass context object to lambda connections

Remove some unneeded lambda () brackets.
Glue lambda brackets with parameters brackets.

Change-Id: I5df67cf01e497ad39c070a3f138a647762f2c33c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-12-07 23:20:02 +01:00
parent 448471a399
commit fc6b7996b8
7 changed files with 19 additions and 24 deletions

View File

@@ -948,9 +948,7 @@ void CdbEngine::runCommand(const DebuggerCommand &dbgCmd)
QString cmd = dbgCmd.function + dbgCmd.argsToString();
if (!m_accessible) {
doInterruptInferior([this, dbgCmd](){
runCommand(dbgCmd);
});
doInterruptInferior([this, dbgCmd] { runCommand(dbgCmd); });
const QString msg = QString("Attempt to issue command \"%1\" to non-accessible session (%2)... interrupting")
.arg(cmd, stateName(state()));
showMessage(msg, LogMisc);

View File

@@ -604,14 +604,10 @@ StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) :
m_okButton = box->button(QDialogButtonBox::Ok);
m_okButton->setEnabled(false);
connect(m_lineEdit, &QLineEdit::textChanged,
this, &StartRemoteCdbDialog::textChanged);
connect(m_lineEdit, &QLineEdit::returnPressed,
[this] { m_okButton->animateClick(); });
connect(box, &QDialogButtonBox::accepted,
this, &StartRemoteCdbDialog::accept);
connect(box, &QDialogButtonBox::rejected,
this, &QDialog::reject);
connect(m_lineEdit, &QLineEdit::textChanged, this, &StartRemoteCdbDialog::textChanged);
connect(m_lineEdit, &QLineEdit::returnPressed, m_okButton, &QAbstractButton::animateClick);
connect(box, &QDialogButtonBox::accepted, this, &StartRemoteCdbDialog::accept);
connect(box, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
void StartRemoteCdbDialog::accept()

View File

@@ -796,9 +796,9 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
vbox->insertWidget(0, label);
};
const auto addFontSizeAdaptation = [](QWidget *widget) {
const auto addFontSizeAdaptation = [this](QWidget *widget) {
QObject::connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
[widget](const FontSettings &settings) {
this, [widget](const FontSettings &settings) {
if (!debuggerSettings()->fontSizeFollowsEditor.value())
return;
qreal size = settings.fontZoom() * settings.fontSize() / 100.;
@@ -1148,7 +1148,8 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
DebuggerMainWindow::leaveDebugMode();
});
connect(ModeManager::instance(), &ModeManager::currentModeChanged, [](Id mode, Id oldMode) {
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, [](Id mode, Id oldMode) {
QTC_ASSERT(mode != oldMode, return);
if (mode == MODE_DEBUG) {
DebuggerMainWindow::enterDebugMode();
@@ -1876,7 +1877,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
: Tr::tr("Set Breakpoint at Line %1").arg(lineNumber);
auto act = menu->addAction(text);
act->setEnabled(args.isValid());
connect(act, &QAction::triggered, [this, args] {
connect(act, &QAction::triggered, this, [this, args] {
breakpointSetMarginActionTriggered(false, args);
});
@@ -1886,7 +1887,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
: Tr::tr("Set Message Tracepoint at Line %1...").arg(lineNumber);
act = menu->addAction(tracePointText);
act->setEnabled(args.isValid());
connect(act, &QAction::triggered, [this, args] {
connect(act, &QAction::triggered, this, [this, args] {
breakpointSetMarginActionTriggered(true, args);
});
}

View File

@@ -771,7 +771,7 @@ DebuggerToolTipHolder::DebuggerToolTipHolder(const DebuggerToolTipContext &conte
state = New;
QObject::connect(widget->pinButton, &QAbstractButton::clicked, [this] {
QObject::connect(widget->pinButton, &QAbstractButton::clicked, widget, [this] {
if (widget->isPinned)
widget->close();
else

View File

@@ -445,7 +445,7 @@ void EngineManager::deactivateDebugMode()
// "previously active application"), doing the switch synchronously
// leads to funny effects with floating dock widgets
const Utils::Id mode = d->m_previousMode;
QTimer::singleShot(0, d, [mode]() { ModeManager::activateMode(mode); });
QTimer::singleShot(0, d, [mode] { ModeManager::activateMode(mode); });
d->m_previousMode = Id();
}
}

View File

@@ -38,7 +38,7 @@ LocalsAndInspectorWindow::LocalsAndInspectorWindow(QWidget *locals,
// when debugger engine changes states.
m_timer.setSingleShot(true);
m_timer.setInterval(500); // TODO: remove the magic number!
connect(&m_timer, &QTimer::timeout, [this, localsAndInspector] {
connect(&m_timer, &QTimer::timeout, this, [this, localsAndInspector] {
localsAndInspector->setCurrentIndex(m_showLocals ? LocalsIndex : InspectorIndex);
});
}

View File

@@ -719,7 +719,7 @@ void UvscEngine::handleUpdateLocals(bool partial)
watchHandler()->appendFormatRequests(&cmd);
watchHandler()->appendWatchersAndTooltipRequests(&cmd);
auto enumerateExpandedINames = [&cmd]() {
auto enumerateExpandedINames = [&cmd] {
QStringList inames;
const QJsonArray array = cmd.args["expanded"].toArray();
for (const QJsonValue &value : array)
@@ -727,7 +727,7 @@ void UvscEngine::handleUpdateLocals(bool partial)
return inames;
};
auto enumerateRootWatchers = [&cmd]() {
auto enumerateRootWatchers = [&cmd] {
std::vector<std::pair<QString, QString>> inames;
const QJsonArray array = cmd.args["watchers"].toArray();
for (const QJsonValue &value : array) {