Clean up some lambdas

Change-Id: Id947c0935b1aa4579e1c64d3e510db41103fbe27
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-12-12 11:34:17 +01:00
parent 8d2cee31e4
commit 016936a450
106 changed files with 237 additions and 241 deletions

View File

@@ -103,7 +103,7 @@ struct AutoHideTabPrivate
AbstractFloatingWidget *createFloatingWidget(T *widget)
{
auto w = new FloatingDragPreview(widget);
q->connect(w, &FloatingDragPreview::draggingCanceled, [=]() {
q->connect(w, &FloatingDragPreview::draggingCanceled, [this] {
m_dragState = DraggingInactive;
});
return w;

View File

@@ -321,7 +321,7 @@ DockContainerWidgetPrivate::DockContainerWidgetPrivate(DockContainerWidget *pare
std::fill(std::begin(m_lastAddedAreaCache), std::end(m_lastAddedAreaCache), nullptr);
m_delayedAutoHideTimer.setSingleShot(true);
m_delayedAutoHideTimer.setInterval(500);
QObject::connect(&m_delayedAutoHideTimer, &QTimer::timeout, q, [this]() {
QObject::connect(&m_delayedAutoHideTimer, &QTimer::timeout, q, [this] {
auto globalPos = m_delayedAutoHideTab->mapToGlobal(QPoint(0, 0));
qApp->sendEvent(m_delayedAutoHideTab,
new QMouseEvent(QEvent::MouseButtonPress,

View File

@@ -333,7 +333,7 @@ DockManager::DockManager(QWidget *parent)
: DockContainerWidget(this, parent)
, d(new DockManagerPrivate(this))
{
connect(this, &DockManager::workspaceListChanged, this, [=] {
connect(this, &DockManager::workspaceListChanged, this, [this] {
d->m_workspaceOrderDirty = true;
});

View File

@@ -105,7 +105,7 @@ public:
return new FloatingDockContainer(widget);
} else {
auto w = new FloatingDragPreview(widget);
QObject::connect(w, &FloatingDragPreview::draggingCanceled, q, [=]() {
QObject::connect(w, &FloatingDragPreview::draggingCanceled, q, [this] {
m_dragState = DraggingInactive;
});
return w;

View File

@@ -85,7 +85,7 @@ void AnnotationItem::update()
m_textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
m_textItem->installSceneEventFilter(this);
QObject::connect(m_textItem->document(), &QTextDocument::contentsChanged, m_textItem,
[=]() { this->onContentsChanged(); } );
[this] { this->onContentsChanged(); } );
}
m_textItem->setFont(style->normalFont());
m_textItem->setDefaultTextColor(style->textBrush().color());

View File

@@ -87,7 +87,7 @@ void BoundaryItem::update()
m_textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
m_textItem->installSceneEventFilter(this);
QObject::connect(m_textItem->document(), &QTextDocument::contentsChanged, m_textItem,
[=]() { this->onContentsChanged(); } );
[this] { this->onContentsChanged(); } );
}
m_textItem->setFont(style->normalFont());
m_textItem->setDefaultTextColor(style->textBrush().color());

View File

@@ -574,14 +574,13 @@ void ObjectItem::updateNameItem(const Style *style)
textOption.setAlignment(Qt::AlignHCenter);
m_nameItem->document()->setDefaultTextOption(textOption);
QObject::connect(m_nameItem->document(), &QTextDocument::contentsChanged, m_nameItem,
[=]()
{
[this] {
this->m_nameItem->setTextWidth(-1);
this->m_nameItem->setTextWidth(m_nameItem->boundingRect().width());
this->setFromDisplayName(m_nameItem->toPlainText());
});
QObject::connect(m_nameItem, &EditableTextItem::returnKeyPressed, m_nameItem,
[=]() { this->m_nameItem->clearFocus(); });
[this] { this->m_nameItem->clearFocus(); });
}
if (style->headerFont() != m_nameItem->font())
m_nameItem->setFont(style->headerFont());

View File

@@ -119,7 +119,7 @@ TerminalView::TerminalView(QWidget *parent)
setupSurface();
setFont(QFont(defaultFontFamily(), defaultFontSize()));
connect(&d->m_cursorBlinkTimer, &QTimer::timeout, this, [this]() {
connect(&d->m_cursorBlinkTimer, &QTimer::timeout, this, [this] {
if (hasFocus())
d->m_cursorBlinkState = !d->m_cursorBlinkState;
else
@@ -140,7 +140,7 @@ TerminalView::TerminalView(QWidget *parent)
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
connect(&d->m_flushDelayTimer, &QTimer::timeout, this, [this]() { flushVTerm(true); });
connect(&d->m_flushDelayTimer, &QTimer::timeout, this, [this] { flushVTerm(true); });
connect(&d->m_scrollTimer, &QTimer::timeout, this, [this] {
if (d->m_scrollDirection < 0)

View File

@@ -178,7 +178,7 @@ TimelineModel::TimelineModel(TimelineModelAggregator *parent) :
connect(this, &TimelineModel::expandedChanged, this, &TimelineModel::rowCountChanged);
connect(this, &TimelineModel::contentChanged, this, &TimelineModel::rowCountChanged);
connect(this, &TimelineModel::contentChanged,
this, [this]() { emit expandedRowHeightChanged(-1, -1); });
this, [this] { emit expandedRowHeightChanged(-1, -1); });
}
TimelineModel::~TimelineModel()

View File

@@ -60,7 +60,7 @@ private:
TextEditor::GenericProposal *handleCodeActionResult(const CodeActionResult &result) override
{
auto toOperation =
[=](const std::variant<Command, CodeAction> &item) -> QuickFixOperation * {
[this](const std::variant<Command, CodeAction> &item) -> QuickFixOperation * {
if (auto action = std::get_if<CodeAction>(&item)) {
const std::optional<QList<Diagnostic>> diagnostics = action->diagnostics();
if (!diagnostics.has_value() || diagnostics->isEmpty())

View File

@@ -281,7 +281,7 @@ void Manager::initialize()
d->m_timer.start(400); // Accumulate multiple requests into one, restarts the timer
});
connect(&d->m_timer, &QTimer::timeout, this, [this]() {
connect(&d->m_timer, &QTimer::timeout, this, [this] {
const QSet<FilePath> docsToBeUpdated = d->m_awaitingDocuments;
d->cancelScheduledUpdate();
if (!state() || d->disableCodeParser) // enabling any of them will trigger the total update

View File

@@ -96,7 +96,7 @@ void CocoPlugin::initialize()
Command *cmd = ActionManager::registerAction(startCoco, "Coco.startCoco");
menu->addAction(cmd, Debugger::Constants::G_ANALYZER_TOOLS);
connect(startCoco, &QAction::triggered, this, [this]() { d->startCoco(); });
connect(startCoco, &QAction::triggered, this, [this] { d->startCoco(); });
}
}

View File

@@ -560,7 +560,7 @@ void EditorWidget::addCompiler(const std::shared_ptr<SourceSettings> &sourceSett
sourceSettings->compilers.removeItem(compilerSettings->shared_from_this());
});
connect(compiler, &CompilerWidget::gotFocus, this, [this]() {
connect(compiler, &CompilerWidget::gotFocus, this, [this] {
m_actionHandler.updateCurrentEditor();
});
}
@@ -600,7 +600,7 @@ void EditorWidget::addSourceEditor(const std::shared_ptr<SourceSettings> &source
setupHelpWidget();
});
connect(sourceEditor, &SourceEditorWidget::gotFocus, this, [this]() {
connect(sourceEditor, &SourceEditorWidget::gotFocus, this, [this] {
m_actionHandler.updateCurrentEditor();
});

View File

@@ -91,7 +91,7 @@ public:
m_timer = new QTimer(this);
m_timer->setInterval(100);
connect(m_timer, &QTimer::timeout, this, [this]() {
connect(m_timer, &QTimer::timeout, this, [this] {
m_socket.connectToHost(m_hostName, m_port);
m_socket.waitForConnected();

View File

@@ -253,12 +253,12 @@ void AttachCoreDialog::accepted()
AsyncTask<ResultType>{[this, copyFileAsync](auto &task) {
task.setConcurrentCallData(copyFileAsync, coreFile());
},
[=](const Async<ResultType> &task) { d->coreFileResult = task.result(); },
[this](const Async<ResultType> &task) { d->coreFileResult = task.result(); },
CallDoneIf::Success},
AsyncTask<ResultType>{[this, copyFileAsync](auto &task) {
task.setConcurrentCallData(copyFileAsync, symbolFile());
},
[=](const Async<ResultType> &task) { d->symbolFileResult = task.result(); },
[this](const Async<ResultType> &task) { d->symbolFileResult = task.result(); },
CallDoneIf::Success}
};

View File

@@ -103,7 +103,7 @@ GitLabCloneDialog::GitLabCloneDialog(const Project &project, QWidget *parent)
connect(m_cloneButton, &QPushButton::clicked, this, &GitLabCloneDialog::cloneProject);
connect(m_cancelButton, &QPushButton::clicked,
this, &GitLabCloneDialog::cancel);
connect(this, &QDialog::rejected, this, [this]() {
connect(this, &QDialog::rejected, this, [this] {
if (m_commandRunning) {
cancel();
QApplication::restoreOverrideCursor();

View File

@@ -167,8 +167,7 @@ GlslEditorWidget::GlslEditorWidget()
connect(&m_updateDocumentTimer, &QTimer::timeout,
this, &GlslEditorWidget::updateDocumentNow);
connect(this, &QPlainTextEdit::textChanged,
[this]() { m_updateDocumentTimer.start(); });
connect(this, &QPlainTextEdit::textChanged, [this] { m_updateDocumentTimer.start(); });
m_outlineCombo = new QComboBox;
m_outlineCombo->setMinimumContentsLength(22);

View File

@@ -204,7 +204,7 @@ DocSettingsPageWidget::DocSettingsPageWidget()
&QSortFilterProxyModel::setFilterFixedString);
connect(addButton, &QAbstractButton::clicked, this, &DocSettingsPageWidget::addDocumentation);
connect(removeButton, &QAbstractButton::clicked, this, [this]() {
connect(removeButton, &QAbstractButton::clicked, this, [this] {
removeDocumentation(currentSelection());
});

View File

@@ -240,7 +240,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
addSideBar();
m_toggleSideBarAction->setChecked(m_sideBar->isVisibleTo(this));
connect(m_toggleSideBarAction, &QAction::triggered, m_sideBar, &Core::SideBar::setVisible);
connect(m_sideBar, &Core::SideBar::sideBarClosed, m_toggleSideBarAction, [this]() {
connect(m_sideBar, &Core::SideBar::sideBarClosed, m_toggleSideBarAction, [this] {
m_toggleSideBarAction->setChecked(false);
});
if (style == ExternalWindow) {
@@ -386,7 +386,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
m_printAction = new QAction(this);
Core::ActionManager::registerAction(m_printAction, Core::Constants::PRINT, context);
connect(m_printAction, &QAction::triggered, this, [this]() { print(currentViewer()); });
connect(m_printAction, &QAction::triggered, this, [this] { print(currentViewer()); });
m_copy = new QAction(this);
Core::ActionManager::registerAction(m_copy, Core::Constants::COPY, context);
@@ -426,20 +426,20 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
openMenu->addAction(m_switchToHelp);
if (style != SideBarWidget) {
QAction *openSideBySide = openMenu->addAction(Tr::tr("Open in Edit Mode"));
connect(openSideBySide, &QAction::triggered, this, [this]() {
connect(openSideBySide, &QAction::triggered, this, [this] {
postRequestShowHelpUrl(Core::HelpManager::SideBySideAlways);
});
}
if (supportsPages()) {
QAction *openPage = openMenu->addAction(Tr::tr("Open in New Page"));
connect(openPage, &QAction::triggered, this, [this]() {
connect(openPage, &QAction::triggered, this, [this] {
if (HelpViewer *viewer = currentViewer())
openNewPage(viewer->source());
});
}
if (style != ExternalWindow) {
QAction *openExternal = openMenu->addAction(Tr::tr("Open in Window"));
connect(openExternal, &QAction::triggered, this, [this]() {
connect(openExternal, &QAction::triggered, this, [this] {
postRequestShowHelpUrl(Core::HelpManager::ExternalHelpAlways);
});
}
@@ -458,7 +458,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
layout->addWidget(button);
QAction *reload = openMenu->addAction(Tr::tr("Reload"));
connect(reload, &QAction::triggered, this, [this]() {
connect(reload, &QAction::triggered, this, [this] {
const int index = m_viewerStack->currentIndex();
HelpViewer *previous = currentViewer();
insertViewer(index, previous->source());
@@ -621,20 +621,20 @@ void HelpWidget::addSideBar()
m_sideBar->readSettings(Core::ICore::settings(), sideBarSettingsKey());
m_sideBarSplitter->setSizes(QList<int>() << m_sideBar->size().width() << 300);
connect(m_contentsAction, &QAction::triggered, m_sideBar, [this]() {
connect(m_contentsAction, &QAction::triggered, m_sideBar, [this] {
m_sideBar->activateItem(Constants::HELP_CONTENTS);
});
connect(m_indexAction, &QAction::triggered, m_sideBar, [this]() {
connect(m_indexAction, &QAction::triggered, m_sideBar, [this] {
m_sideBar->activateItem(Constants::HELP_INDEX);
});
connect(m_bookmarkAction, &QAction::triggered, m_sideBar, [this]() {
connect(m_bookmarkAction, &QAction::triggered, m_sideBar, [this] {
m_sideBar->activateItem(Constants::HELP_BOOKMARKS);
});
connect(m_searchAction, &QAction::triggered, m_sideBar, [this]() {
connect(m_searchAction, &QAction::triggered, m_sideBar, [this] {
m_sideBar->activateItem(Constants::HELP_SEARCH);
});
if (m_openPagesAction) {
connect(m_openPagesAction, &QAction::triggered, m_sideBar, [this]() {
connect(m_openPagesAction, &QAction::triggered, m_sideBar, [this] {
m_sideBar->activateItem(Constants::HELP_OPENPAGES);
});
}

View File

@@ -166,7 +166,7 @@ public:
connect(m_clientInterface, &InterfaceController::messageReceived, q, &Client::handleMessage);
connect(m_clientInterface, &InterfaceController::error, q, &Client::setError);
connect(m_clientInterface, &InterfaceController::finished, q, &Client::finished);
connect(m_clientInterface, &InterfaceController::started, this, [this]() {
connect(m_clientInterface, &InterfaceController::started, this, [this] {
LanguageClientManager::clientStarted(q);
});
connect(Core::EditorManager::instance(),
@@ -1479,7 +1479,7 @@ void Client::setCurrentProject(ProjectExplorer::Project *project)
d->m_project->disconnect(this);
d->m_project = project;
if (d->m_project) {
connect(d->m_project, &ProjectExplorer::Project::destroyed, this, [this]() {
connect(d->m_project, &ProjectExplorer::Project::destroyed, this, [this] {
// the project of the client should already be null since we expect the session and
// the language client manager to reset it before it gets deleted.
QTC_ASSERT(d->m_project == nullptr, projectClosed(d->m_project));

View File

@@ -24,7 +24,7 @@ LanguageClientFormatter::LanguageClientFormatter(TextEditor::TextDocument *docum
{
m_cancelConnection = QObject::connect(document->document(),
&QTextDocument::contentsChanged,
[this]() {
[this] {
if (m_ignoreCancel)
m_ignoreCancel = false;
else
@@ -93,7 +93,7 @@ QFutureWatcher<ChangeSet> *LanguageClientFormatter::format(
m_ignoreCancel = true;
m_progress.reportStarted();
auto watcher = new QFutureWatcher<ChangeSet>();
QObject::connect(watcher, &QFutureWatcher<ChangeSet>::canceled, [this]() {
QObject::connect(watcher, &QFutureWatcher<ChangeSet>::canceled, [this] {
cancelCurrentRequest();
});
watcher->setFuture(m_progress.future());

View File

@@ -31,7 +31,7 @@ SemanticTokenSupport::SemanticTokenSupport(Client *client)
QObject::connect(TextEditorSettings::instance(),
&TextEditorSettings::fontSettingsChanged,
client,
[this]() { updateFormatHash(); });
[this] { updateFormatHash(); });
QObject::connect(Core::EditorManager::instance(),
&Core::EditorManager::currentEditorChanged,
this,

View File

@@ -212,7 +212,7 @@ void McuSupportPlugin::extensionsInitialized()
{
ProjectExplorer::DeviceManager::instance()->addDevice(McuSupportDevice::create());
connect(KitManager::instance(), &KitManager::kitsLoaded, [this]() {
connect(KitManager::instance(), &KitManager::kitsLoaded, [this] {
McuKitManager::removeOutdatedKits();
McuKitManager::createAutomaticKits(dd->m_settingsHandler);
McuKitManager::fixExistingKits(dd->m_settingsHandler);

View File

@@ -96,7 +96,7 @@ void ToolKitAspectWidget::loadTools()
void ToolKitAspectWidget::setToDefault()
{
const MesonTools::Tool_t autoDetected = [this]() {
const MesonTools::Tool_t autoDetected = [this] {
if (m_type == ToolType::Meson)
return std::dynamic_pointer_cast<ToolWrapper>(MesonTools::mesonWrapper());
return std::dynamic_pointer_cast<ToolWrapper>(MesonTools::ninjaWrapper());

View File

@@ -44,7 +44,7 @@ private:
void refresh() override
{
const auto id = [this]() {
const auto id = [this] {
if (m_type == ToolType::Meson)
return MesonToolKitAspect::mesonToolId(m_kit);
return NinjaToolKitAspect::ninjaToolId(m_kit);

View File

@@ -307,25 +307,25 @@ void ModelEditor::init()
toolbarLayout->addStretch(1);
toolbarLayout->addWidget(createToolbarCommandButton(Core::Constants::ZOOM_RESET,
[this]() { resetZoom(); },
[this] { resetZoom(); },
d->toolbar));
toolbarLayout->addWidget(createToolbarCommandButton(Core::Constants::ZOOM_IN,
[this]() { zoomIn(); },
[this] { zoomIn(); },
d->toolbar));
toolbarLayout->addWidget(createToolbarCommandButton(Core::Constants::ZOOM_OUT,
[this]() { zoomOut(); },
[this] { zoomOut(); },
d->toolbar));
toolbarLayout->addWidget(createToolbarCommandButton(Constants::ACTION_ADD_PACKAGE,
[this]() { onAddPackage(); },
[this] { onAddPackage(); },
d->toolbar));
toolbarLayout->addWidget(createToolbarCommandButton(Constants::ACTION_ADD_COMPONENT,
[this]() { onAddComponent(); },
[this] { onAddComponent(); },
d->toolbar));
toolbarLayout->addWidget(createToolbarCommandButton(Constants::ACTION_ADD_CLASS,
[this]() { onAddClass(); },
[this] { onAddClass(); },
d->toolbar));
toolbarLayout->addWidget(createToolbarCommandButton(Constants::ACTION_ADD_CANVAS_DIAGRAM,
[this]() { onAddCanvasDiagram(); },
[this] { onAddCanvasDiagram(); },
d->toolbar));
toolbarLayout->addSpacing(20);
@@ -871,7 +871,7 @@ void ModelEditor::onAddPackage()
qmt::MPackage *package = documentController->createNewPackage(d->modelTreeViewServant->selectedPackage());
d->modelTreeView->selectFromSourceModelIndex(documentController->treeModel()->indexOf(package));
QTimer::singleShot(0, this, [this]() { onEditSelectedElement(); });
QTimer::singleShot(0, this, [this] { onEditSelectedElement(); });
}
void ModelEditor::onAddComponent()
@@ -880,7 +880,7 @@ void ModelEditor::onAddComponent()
qmt::MComponent *component = documentController->createNewComponent(d->modelTreeViewServant->selectedPackage());
d->modelTreeView->selectFromSourceModelIndex(documentController->treeModel()->indexOf(component));
QTimer::singleShot(0, this, [this]() { onEditSelectedElement(); });
QTimer::singleShot(0, this, [this] { onEditSelectedElement(); });
}
void ModelEditor::onAddClass()
@@ -889,7 +889,7 @@ void ModelEditor::onAddClass()
qmt::MClass *klass = documentController->createNewClass(d->modelTreeViewServant->selectedPackage());
d->modelTreeView->selectFromSourceModelIndex(documentController->treeModel()->indexOf(klass));
QTimer::singleShot(0, this, [this]() { onEditSelectedElement(); });
QTimer::singleShot(0, this, [this] { onEditSelectedElement(); });
}
void ModelEditor::onAddCanvasDiagram()
@@ -898,7 +898,7 @@ void ModelEditor::onAddCanvasDiagram()
qmt::MDiagram *diagram = documentController->createNewCanvasDiagram(d->modelTreeViewServant->selectedPackage());
d->modelTreeView->selectFromSourceModelIndex(documentController->treeModel()->indexOf(diagram));
QTimer::singleShot(0, this, [this]() { onEditSelectedElement(); });
QTimer::singleShot(0, this, [this] { onEditSelectedElement(); });
}
void ModelEditor::onCurrentEditorChanged(Core::IEditor *editor)
@@ -987,7 +987,7 @@ void ModelEditor::onNewElementCreated(qmt::DElement *element, qmt::MDiagram *dia
documentController->diagramsManager()->diagramSceneModel(diagram)->selectElement(element);
qmt::MElement *melement = documentController->modelController()->findElement(element->modelUid());
if (!(melement && melement->flags().testFlag(qmt::MElement::ReverseEngineered)))
QTimer::singleShot(0, this, [this]() { onEditSelectedElement(); });
QTimer::singleShot(0, this, [this] { onEditSelectedElement(); });
}
}

View File

@@ -64,7 +64,7 @@ PerfDataReader::PerfDataReader(QObject *parent) :
});
connect(&m_input, &QIODevice::bytesWritten, this, &PerfDataReader::writeChunk);
connect(&m_input, &QProcess::started, this, [this]() {
connect(&m_input, &QProcess::started, this, [this] {
emit processStarted();
if (m_input.isWritable()) {
writeChunk();
@@ -109,7 +109,7 @@ PerfDataReader::PerfDataReader(QObject *parent) :
});
connect(&m_input, &QProcess::readyReadStandardOutput, this, &PerfDataReader::readFromDevice);
connect(&m_input, &QProcess::readyReadStandardError, this, [this]() {
connect(&m_input, &QProcess::readyReadStandardError, this, [this] {
Core::MessageManager::writeSilently(QString::fromLocal8Bit(m_input.readAllStandardError()));
});

View File

@@ -88,7 +88,7 @@ PerfProfilerTool::PerfProfilerTool()
m_limitToRange = new QAction(Tr::tr("Limit to Range Selected in Timeline"), options);
command = Core::ActionManager::registerAction(m_limitToRange, Constants::PerfProfilerTaskLimit,
globalContext);
connect(m_limitToRange, &QAction::triggered, this, [this]() {
connect(m_limitToRange, &QAction::triggered, this, [this] {
traceManager().restrictByFilter(traceManager().rangeAndThreadFilter(
m_zoomControl->selectionStart(),
m_zoomControl->selectionEnd()));
@@ -271,12 +271,12 @@ void PerfProfilerTool::createViews()
errorDialog->show();
});
connect(&traceManager(), &PerfProfilerTraceManager::loadFinished, this, [this]() {
connect(&traceManager(), &PerfProfilerTraceManager::loadFinished, this, [this] {
m_readerRunning = false;
updateRunActions();
});
connect(&traceManager(), &PerfProfilerTraceManager::saveFinished, this, [this]() {
connect(&traceManager(), &PerfProfilerTraceManager::saveFinished, this, [this] {
setToolActionsEnabled(true);
});

View File

@@ -119,7 +119,7 @@ PerfProfilerTraceManager::PerfProfilerTraceManager()
&m_reparseTimer, QOverload<>::of(&QTimer::start));
connect(&m_reparseTimer, &QTimer::timeout,
this, [this]() { restrictByFilter(rangeAndThreadFilter(traceStart(), traceEnd())); });
this, [this] { restrictByFilter(rangeAndThreadFilter(traceStart(), traceEnd())); });
resetAttributes();
}

View File

@@ -93,7 +93,7 @@ PerfConfigWidget::PerfConfigWidget(PerfSettings *settings, Target *target)
this, &PerfConfigWidget::readTracePoints);
auto addEventButton = new QPushButton(Tr::tr("Add Event"), this);
connect(addEventButton, &QPushButton::pressed, this, [this]() {
connect(addEventButton, &QPushButton::pressed, this, [this] {
auto model = eventsView->model();
model->insertRow(model->rowCount());
});

View File

@@ -1191,7 +1191,7 @@ void QmakeProFile::setupFutureWatcher()
QTC_ASSERT(!m_parseFutureWatcher, return);
m_parseFutureWatcher = new QFutureWatcher<Internal::QmakeEvalResultPtr>;
QObject::connect(m_parseFutureWatcher, &QFutureWatcherBase::finished, [this]() {
QObject::connect(m_parseFutureWatcher, &QFutureWatcherBase::finished, [this] {
applyEvaluate(m_parseFutureWatcher->result());
cleanupFutureWatcher();
});

View File

@@ -91,7 +91,7 @@ AssetExportDialog::AssetExportDialog(const FilePath &exportPath,
m_exportPath->setPromptDialogTitle(tr("Choose Export File"));
m_exportPath->setPromptDialogFilter(tr("Metadata file (*.metadata)"));
m_exportPath->lineEdit()->setReadOnly(true);
m_exportPath->addButton(tr("Open"), this, [this]() {
m_exportPath->addButton(tr("Open"), this, [this] {
Core::FileUtils::showInGraphicalShell(Core::ICore::dialogParent(), m_exportPath->filePath());
});
@@ -111,7 +111,7 @@ AssetExportDialog::AssetExportDialog(const FilePath &exportPath,
m_stackedWidget->addWidget(m_exportLogs);
switchView(false);
connect(m_buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, [this]() {
connect(m_buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, [this] {
m_buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(false);
m_assetExporter.cancel();
});
@@ -119,13 +119,13 @@ AssetExportDialog::AssetExportDialog(const FilePath &exportPath,
m_exportBtn = m_buttonBox->addButton(tr("Export"), QDialogButtonBox::AcceptRole);
m_exportBtn->setEnabled(false);
connect(m_exportBtn, &QPushButton::clicked, this, &AssetExportDialog::onExport);
connect(&m_filePathModel, &FilePathModel::modelReset, this, [this]() {
connect(&m_filePathModel, &FilePathModel::modelReset, this, [this] {
m_exportProgress->setRange(0, 1000);
m_exportProgress->setValue(0);
m_exportBtn->setEnabled(true);
});
connect(m_buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, [this]() {
connect(m_buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, [this] {
close();
});
m_buttonBox->button(QDialogButtonBox::Close)->setVisible(false);

View File

@@ -24,9 +24,9 @@ AnnotationTabWidget::AnnotationTabWidget(QWidget *parent)
tr("Add Comment")); //timeline icons?
auto *commentRemoveAction = new QAction(TimelineIcons::REMOVE_TIMELINE.icon(),
tr("Remove Comment")); //timeline icons?
connect(commentAddAction, &QAction::triggered, this, [this]() { addCommentTab(); });
connect(commentAddAction, &QAction::triggered, this, [this] { addCommentTab(); });
connect(commentRemoveAction, &QAction::triggered, this, [this]() {
connect(commentRemoveAction, &QAction::triggered, this, [this] {
int currentIndex = this->currentIndex();
QString currentTitle = tabText(currentIndex);
if (QMessageBox::question(this,

View File

@@ -113,7 +113,7 @@ void AssetsLibraryView::setResourcePath(const QString &resourcePath)
AssetsLibraryView::ImageCacheData *AssetsLibraryView::imageCacheData()
{
std::call_once(imageCacheFlag,
[this]() { m_imageCacheData = std::make_unique<ImageCacheData>(); });
[this] { m_imageCacheData = std::make_unique<ImageCacheData>(); });
return m_imageCacheData.get();
}

View File

@@ -54,7 +54,7 @@ BindingEditorWidget::BindingEditorWidget()
? tr("Meta+Space")
: tr("Ctrl+Space")));
connect(m_completionAction, &QAction::triggered, this, [this]() {
connect(m_completionAction, &QAction::triggered, this, [this] {
invokeAssist(TextEditor::Completion);
});
}

View File

@@ -16,7 +16,7 @@ AddNewBackendDialog::AddNewBackendDialog(QWidget *parent) :
connect(m_ui->comboBox, &QComboBox::currentTextChanged, this, &AddNewBackendDialog::invalidate);
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, [this]() {
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, [this] {
m_applied = true;
close();
});

View File

@@ -255,15 +255,15 @@ BindingModelBackendDelegate::BindingModelBackendDelegate(BindingModel *parent)
, m_sourceNode()
, m_sourceNodeProperty()
{
connect(&m_sourceNode, &StudioQmlComboBoxBackend::activated, this, [this]() {
connect(&m_sourceNode, &StudioQmlComboBoxBackend::activated, this, [this] {
sourceNodeChanged();
});
connect(&m_sourceNodeProperty, &StudioQmlComboBoxBackend::activated, this, [this]() {
connect(&m_sourceNodeProperty, &StudioQmlComboBoxBackend::activated, this, [this] {
sourcePropertyNameChanged();
});
connect(&m_property, &StudioQmlComboBoxBackend::activated, this, [this]() {
connect(&m_property, &StudioQmlComboBoxBackend::activated, this, [this] {
targetPropertyNameChanged();
});
}
@@ -373,7 +373,7 @@ void BindingModelBackendDelegate::sourcePropertyNameChanged() const
void BindingModelBackendDelegate::targetPropertyNameChanged() const
{
auto commit = [this]() {
auto commit = [this] {
BindingModel *model = qobject_cast<BindingModel *>(parent());
QTC_ASSERT(model, return);
const PropertyName propertyName = m_property.currentText().toUtf8();

View File

@@ -675,21 +675,21 @@ ConnectionModelBackendDelegate::ConnectionModelBackendDelegate(ConnectionModel *
m_propertyTreeModel(parent->connectionView()), m_propertyListProxyModel(&m_propertyTreeModel)
{
connect(&m_signalDelegate, &PropertyTreeModelDelegate::commitData, this, [this]() {
connect(&m_signalDelegate, &PropertyTreeModelDelegate::commitData, this, [this] {
handleTargetChanged();
});
connect(&m_okStatementDelegate,
&ConnectionModelStatementDelegate::statementChanged,
this,
[this]() { handleOkStatementChanged(); });
[this] { handleOkStatementChanged(); });
connect(&m_koStatementDelegate,
&ConnectionModelStatementDelegate::statementChanged,
this,
[this]() { handleKOStatementChanged(); });
[this] { handleKOStatementChanged(); });
connect(&m_conditionListModel, &ConditionListModel::conditionChanged, this, [this]() {
connect(&m_conditionListModel, &ConditionListModel::conditionChanged, this, [this] {
handleConditionChanged();
});
@@ -1209,27 +1209,27 @@ ConnectionModelStatementDelegate::ConnectionModelStatementDelegate(ConnectionMod
{
m_functionDelegate.setPropertyType(PropertyTreeModel::SlotType);
connect(&m_functionDelegate, &PropertyTreeModelDelegate::commitData, this, [this]() {
connect(&m_functionDelegate, &PropertyTreeModelDelegate::commitData, this, [this] {
handleFunctionChanged();
});
connect(&m_rhsAssignmentDelegate, &PropertyTreeModelDelegate::commitData, this, [this]() {
connect(&m_rhsAssignmentDelegate, &PropertyTreeModelDelegate::commitData, this, [this] {
handleRhsAssignmentChanged();
});
connect(&m_lhsDelegate, &PropertyTreeModelDelegate::commitData, this, [this]() {
connect(&m_lhsDelegate, &PropertyTreeModelDelegate::commitData, this, [this] {
handleLhsChanged();
});
connect(&m_stringArgument, &StudioQmlTextBackend::activated, this, [this]() {
connect(&m_stringArgument, &StudioQmlTextBackend::activated, this, [this] {
handleStringArgumentChanged();
});
connect(&m_states, &StudioQmlComboBoxBackend::activated, this, [this]() {
connect(&m_states, &StudioQmlComboBoxBackend::activated, this, [this] {
handleStateChanged();
});
connect(&m_stateTargets, &StudioQmlComboBoxBackend::activated, this, [this]() {
connect(&m_stateTargets, &StudioQmlComboBoxBackend::activated, this, [this] {
handleStateTargetsChanged();
});
}

View File

@@ -388,9 +388,9 @@ DynamicPropertiesModelBackendDelegate::DynamicPropertiesModelBackendDelegate(Dyn
, m_internalNodeId(std::nullopt)
{
m_type.setModel({"int", "bool", "var", "real", "string", "url", "color"});
connect(&m_type, &StudioQmlComboBoxBackend::activated, this, [this]() { handleTypeChanged(); });
connect(&m_name, &StudioQmlTextBackend::activated, this, [this]() { handleNameChanged(); });
connect(&m_value, &StudioQmlTextBackend::activated, this, [this]() { handleValueChanged(); });
connect(&m_type, &StudioQmlComboBoxBackend::activated, this, [this] { handleTypeChanged(); });
connect(&m_name, &StudioQmlTextBackend::activated, this, [this] { handleNameChanged(); });
connect(&m_value, &StudioQmlTextBackend::activated, this, [this] { handleValueChanged(); });
}
void DynamicPropertiesModelBackendDelegate::update(const AbstractProperty &property)

View File

@@ -888,10 +888,10 @@ QString PropertyListProxyModel::parentName() const
PropertyTreeModelDelegate::PropertyTreeModelDelegate(ConnectionView *parent) : m_model(parent)
{
connect(&m_nameCombboBox, &StudioQmlComboBoxBackend::activated, this, [this]() {
connect(&m_nameCombboBox, &StudioQmlComboBoxBackend::activated, this, [this] {
handleNameChanged();
});
connect(&m_idCombboBox, &StudioQmlComboBoxBackend::activated, this, [this]() {
connect(&m_idCombboBox, &StudioQmlComboBoxBackend::activated, this, [this] {
handleIdChanged();
});

View File

@@ -151,7 +151,7 @@ QString ContentLibraryBundleImporter::importComponent(const QString &qmlFile,
void ContentLibraryBundleImporter::handleImportTimer()
{
auto handleFailure = [this]() {
auto handleFailure = [this] {
m_importTimer.stop();
m_fullReset = false;
m_importAddPending = false;

View File

@@ -57,7 +57,7 @@ CurveEditor::CurveEditor(CurveEditorModel *model, QWidget *parent)
box->addWidget(m_statusLine);
setLayout(box);
connect(m_toolbar, &CurveEditorToolBar::unifyClicked, [this]() {
connect(m_toolbar, &CurveEditorToolBar::unifyClicked, [this] {
m_view->toggleUnified();
});

View File

@@ -75,16 +75,16 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent)
m_splineAction = addAction(Theme::iconFromName(Theme::bezier_medium), tr(m_splineLabel));
m_unifyAction = addAction(Theme::iconFromName(Theme::unify_medium), tr(m_unifyLabel));
auto setLinearInterpolation = [this]() {
auto setLinearInterpolation = [this] {
emit interpolationClicked(Keyframe::Interpolation::Linear);
};
auto setStepInterpolation = [this]() {
auto setStepInterpolation = [this] {
emit interpolationClicked(Keyframe::Interpolation::Step);
};
auto setSplineInterpolation = [this]() {
auto setSplineInterpolation = [this] {
emit interpolationClicked(Keyframe::Interpolation::Bezier);
};
auto toggleUnifyKeyframe = [this]() {
auto toggleUnifyKeyframe = [this] {
emit unifyClicked();
};
@@ -170,7 +170,7 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent)
tr("Zoom Out"),
QKeySequence(QKeySequence::ZoomOut));
connect(zoomOut, &QAction::triggered, [this]() {
connect(zoomOut, &QAction::triggered, [this] {
m_zoomSlider->setValue(m_zoomSlider->value() - m_zoomSlider->pageStep());
});
@@ -179,7 +179,7 @@ CurveEditorToolBar::CurveEditorToolBar(CurveEditorModel *model, QWidget* parent)
tr("Zoom In"),
QKeySequence(QKeySequence::ZoomIn));
connect(zoomIn, &QAction::triggered, [this]() {
connect(zoomIn, &QAction::triggered, [this] {
m_zoomSlider->setValue(m_zoomSlider->value() + m_zoomSlider->pageStep());
});

View File

@@ -410,7 +410,7 @@ void GraphicsView::contextMenuEvent(QContextMenuEvent *event)
if (event->modifiers() != Qt::NoModifier)
return;
auto openStyleEditor = [this]() { m_dialog.show(); };
auto openStyleEditor = [this] { m_dialog.show(); };
QMenu menu;

View File

@@ -193,7 +193,7 @@ void KeyframeItem::setKeyframe(const Keyframe &keyframe)
m_frame = keyframe;
if (needsConnection) {
auto updatePosition = [this]() { this->updatePosition(true); };
auto updatePosition = [this] { this->updatePosition(true); };
connect(this, &QGraphicsObject::xChanged, updatePosition);
connect(this, &QGraphicsObject::yChanged, updatePosition);
}
@@ -201,7 +201,7 @@ void KeyframeItem::setKeyframe(const Keyframe &keyframe)
if (m_frame.hasLeftHandle()) {
if (!m_left) {
m_left = new HandleItem(this, HandleItem::Slot::Left);
auto updateLeftHandle = [this]() { updateHandle(m_left); };
auto updateLeftHandle = [this] { updateHandle(m_left); };
connect(m_left, &QGraphicsObject::xChanged, updateLeftHandle);
connect(m_left, &QGraphicsObject::yChanged, updateLeftHandle);
}
@@ -214,7 +214,7 @@ void KeyframeItem::setKeyframe(const Keyframe &keyframe)
if (m_frame.hasRightHandle()) {
if (!m_right) {
m_right = new HandleItem(this, HandleItem::Slot::Right);
auto updateRightHandle = [this]() { updateHandle(m_right); };
auto updateRightHandle = [this] { updateHandle(m_right); };
connect(m_right, &QGraphicsObject::xChanged, updateRightHandle);
connect(m_right, &QGraphicsObject::yChanged, updateRightHandle);
}

View File

@@ -26,7 +26,7 @@ TreeView::TreeView(CurveEditorModel *model, QWidget *parent)
setModel(model);
auto expandItems = [this]() { expandAll(); };
auto expandItems = [this] { expandAll(); };
connect(model, &QAbstractItemModel::modelReset, expandItems);
setItemDelegate(new TreeItemDelegate(model->style(), this));

View File

@@ -183,7 +183,7 @@ void BakeLights::bakeLights()
m_view->resetPuppet();
};
auto crashCallback = [this]() {
auto crashCallback = [this] {
m_progressDialog->raise();
emit progress(tr("Baking process crashed, baking aborted."));
emit finished();
@@ -232,7 +232,7 @@ void BakeLights::apply()
void BakeLights::rebake()
{
QTimer::singleShot(0, this, [this]() {
QTimer::singleShot(0, this, [this] {
cleanup();
showSetupDialog();
});

View File

@@ -1054,7 +1054,7 @@ void Edit3DView::createEdit3DActions()
if (!m_snapConfiguration) {
m_snapConfiguration = new SnapConfiguration(this);
connect(m_snapConfiguration.data(), &SnapConfiguration::posIntChanged,
this, [this]() {
this, [this] {
// Notify every change of position interval as that causes visible changes in grid
rootModelNode().setAuxiliaryData(edit3dSnapPosIntProperty,
m_snapConfiguration->posInt());

View File

@@ -235,7 +235,7 @@ void SnapConfiguration::setScaleInt(double value)
void SnapConfiguration::asyncClose()
{
QTimer::singleShot(0, this, [this]() {
QTimer::singleShot(0, this, [this] {
if (!m_configDialog.isNull() && m_configDialog->isVisible())
m_configDialog->close();
});

View File

@@ -51,7 +51,7 @@ void EventListPluginView::registerActions()
&SelectionContextFunctors::always,
&SelectionContextFunctors::always));
auto eventListAction = new EventListAction();
connect(eventListAction->action(), &QAction::triggered, [this]() {
connect(eventListAction->action(), &QAction::triggered, [this] {
if (!m_eventListDialog)
m_eventListDialog = new EventListDialog(Core::ICore::dialogParent());
@@ -62,7 +62,7 @@ void EventListPluginView::registerActions()
designerActionManager.addDesignerAction(eventListAction);
auto assignEventAction = new AssignEventEditorAction();
connect(assignEventAction->action(), &QAction::triggered, [this]() {
connect(assignEventAction->action(), &QAction::triggered, [this] {
if (!m_assigner)
m_assigner = new AssignEventDialog(Core::ICore::dialogParent());
if (!m_eventListDialog)

View File

@@ -182,11 +182,11 @@ void FormEditorAnnotationIcon::mouseReleaseEvent(QGraphicsSceneMouseEvent * even
void FormEditorAnnotationIcon::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
QMenu menu;
menu.addAction(tr("Edit Annotation"), [this]() {
menu.addAction(tr("Edit Annotation"), [this] {
createAnnotationEditor();
});
menu.addAction(tr("Remove Annotation"), [this]() {
menu.addAction(tr("Remove Annotation"), [this] {
removeAnnotationDialog();
});

View File

@@ -208,7 +208,7 @@ void FormEditorView::createFormEditorWidget()
auto formEditorContext = new Internal::FormEditorContext(m_formEditorWidget.data());
Core::ICore::addContextObject(formEditorContext);
connect(m_formEditorWidget->zoomAction(), &ZoomAction::zoomLevelChanged, [this]() {
connect(m_formEditorWidget->zoomAction(), &ZoomAction::zoomLevelChanged, [this] {
m_currentTool->formEditorItemsChanged(scene()->allFormEditorItems());
});
@@ -223,7 +223,7 @@ void FormEditorView::temporaryBlockView(int duration)
timer->setSingleShot(true);
timer->start(duration);
connect(timer, &QTimer::timeout, this, [this]() {
connect(timer, &QTimer::timeout, this, [this] {
if (m_formEditorWidget && m_formEditorWidget->graphicsView())
m_formEditorWidget->graphicsView()->setUpdatesEnabled(true);
});

View File

@@ -162,7 +162,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
const QIcon zoomOutIcon = Theme::iconFromName(Theme::Icon::zoomOut_medium);
const QIcon reloadIcon = Theme::iconFromName(Theme::Icon::reload_medium);
auto writeZoomLevel = [this]() {
auto writeZoomLevel = [this] {
double level = m_graphicsView->transform().m11();
if (level == 1.0) {
m_formEditorView->rootModelNode().removeAuxiliaryData(formeditorZoomProperty);

View File

@@ -574,7 +574,7 @@ void DesignDocument::deleteSelected()
return;
}
rewriterView()->executeInTransaction("DesignDocument::deleteSelected", [this]() {
rewriterView()->executeInTransaction("DesignDocument::deleteSelected", [this] {
const QList<ModelNode> toDelete = view()->selectedModelNodes();
for (ModelNode node : toDelete) {
if (node.isValid() && !node.isRootNode() && QmlObjectNode::isValidQmlObjectNode(node))

View File

@@ -235,7 +235,7 @@ void MaterialBrowserView::modelAttached(Model *model)
// Project load is already very busy and may even trigger puppet reset, so let's wait a moment
// before refreshing the model
QTimer::singleShot(1000, model, [this]() {
QTimer::singleShot(1000, model, [this] {
refreshModel(true);
loadPropertyGroups(); // Needs the delay because it uses metaInfo
});
@@ -523,7 +523,7 @@ void MaterialBrowserView::customNotification(const AbstractView *view,
m_widget->focusMaterialSection(false);
}
} else if (identifier == "refresh_material_browser") {
QTimer::singleShot(0, model(), [this]() {
QTimer::singleShot(0, model(), [this] {
refreshModel(true);
});
} else if (identifier == "delete_selected_material") {
@@ -557,7 +557,7 @@ void MaterialBrowserView::instancesCompleted(const QVector<ModelNode> &completed
// We use root node completion as indication of puppet reset
if (node.isRootNode()) {
m_puppetResetPending = false;
QTimer::singleShot(1000, this, [this]() {
QTimer::singleShot(1000, this, [this] {
if (!model() || !model()->nodeInstanceView())
return;
const QList<ModelNode> materials = m_widget->materialBrowserModel()->materials();

View File

@@ -143,7 +143,7 @@ RichTextEditor::RichTextEditor(QWidget *parent)
this, &RichTextEditor::cursorPositionChanged);
connect(m_textEdit, &QTextEdit::textChanged,
this, &RichTextEditor::onTextChanged);
connect(m_linkDialog, &QDialog::accepted, [this]() {
connect(m_linkDialog, &QDialog::accepted, [this] {
QTextCharFormat oldFormat = m_textEdit->textCursor().charFormat();
QTextCursor tcursor = m_textEdit->textCursor();
@@ -392,7 +392,7 @@ void RichTextEditor::setupTextActions()
void RichTextEditor::setupImageActions()
{
auto insertImage = [this]() {
auto insertImage = [this] {
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setWindowTitle(tr("Select Image"));
@@ -417,7 +417,7 @@ void RichTextEditor::setupImageActions()
void RichTextEditor::setupHyperlinkActions()
{
const QIcon bulletIcon(getIcon(Theme::Icon::actionIconBinding));
m_actionHyperlink = m_toolBar->addAction(bulletIcon, tr("Hyperlink Settings"), [this]() {
m_actionHyperlink = m_toolBar->addAction(bulletIcon, tr("Hyperlink Settings"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
QTextCharFormat linkFormat = cursor.charFormat();
if (linkFormat.isAnchor()) {
@@ -440,25 +440,25 @@ void RichTextEditor::setupHyperlinkActions()
void RichTextEditor::setupAlignActions()
{
const QIcon leftIcon(getIcon(Theme::Icon::textAlignLeft));
m_actionAlignLeft = m_toolBar->addAction(leftIcon, tr("&Left"), [this]() { m_textEdit->setAlignment(Qt::AlignLeft | Qt::AlignAbsolute); });
m_actionAlignLeft = m_toolBar->addAction(leftIcon, tr("&Left"), [this] { m_textEdit->setAlignment(Qt::AlignLeft | Qt::AlignAbsolute); });
m_actionAlignLeft->setShortcut(Qt::CTRL | Qt::Key_L);
m_actionAlignLeft->setCheckable(true);
m_actionAlignLeft->setPriority(QAction::LowPriority);
const QIcon centerIcon(getIcon(Theme::Icon::textAlignCenter));
m_actionAlignCenter = m_toolBar->addAction(centerIcon, tr("C&enter"), [this]() { m_textEdit->setAlignment(Qt::AlignHCenter); });
m_actionAlignCenter = m_toolBar->addAction(centerIcon, tr("C&enter"), [this] { m_textEdit->setAlignment(Qt::AlignHCenter); });
m_actionAlignCenter->setShortcut(Qt::CTRL | Qt::Key_E);
m_actionAlignCenter->setCheckable(true);
m_actionAlignCenter->setPriority(QAction::LowPriority);
const QIcon rightIcon(getIcon(Theme::Icon::textAlignRight));
m_actionAlignRight = m_toolBar->addAction(rightIcon, tr("&Right"), [this]() { m_textEdit->setAlignment(Qt::AlignRight | Qt::AlignAbsolute); });
m_actionAlignRight = m_toolBar->addAction(rightIcon, tr("&Right"), [this] { m_textEdit->setAlignment(Qt::AlignRight | Qt::AlignAbsolute); });
m_actionAlignRight->setShortcut(Qt::CTRL | Qt::Key_R);
m_actionAlignRight->setCheckable(true);
m_actionAlignRight->setPriority(QAction::LowPriority);
const QIcon fillIcon(getIcon(Theme::Icon::textFullJustification));
m_actionAlignJustify = m_toolBar->addAction(fillIcon, tr("&Justify"), [this]() { m_textEdit->setAlignment(Qt::AlignJustify); });
m_actionAlignJustify = m_toolBar->addAction(fillIcon, tr("&Justify"), [this] { m_textEdit->setAlignment(Qt::AlignJustify); });
m_actionAlignJustify->setShortcut(Qt::CTRL | Qt::Key_J);
m_actionAlignJustify->setCheckable(true);
m_actionAlignJustify->setPriority(QAction::LowPriority);
@@ -515,7 +515,7 @@ void RichTextEditor::setupFontActions()
{
QPixmap colorBox(drawColorBox(m_textEdit->textColor(), m_tableBar->iconSize()));
m_actionTextColor = m_toolBar->addAction(colorBox, tr("&Color..."), [this]() {
m_actionTextColor = m_toolBar->addAction(colorBox, tr("&Color..."), [this] {
QColor col = QColorDialog::getColor(m_textEdit->textColor(), this);
if (!col.isValid())
return;
@@ -580,7 +580,7 @@ void RichTextEditor::setupTableActions()
//table bar:
const QIcon createTableIcon(getIcon(Theme::Icon::addTable));
m_actionCreateTable = m_tableBar->addAction(createTableIcon, tr("Create Table"), [this]() {
m_actionCreateTable = m_tableBar->addAction(createTableIcon, tr("Create Table"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
cursorEditBlock(cursor, [&] () {
//format table cells to look a bit better:
@@ -598,7 +598,7 @@ void RichTextEditor::setupTableActions()
m_actionCreateTable->setCheckable(false);
const QIcon removeTableIcon(getIcon(Theme::Icon::deleteTable));
m_actionRemoveTable = m_tableBar->addAction(removeTableIcon, tr("Remove Table"), [this]() {
m_actionRemoveTable = m_tableBar->addAction(removeTableIcon, tr("Remove Table"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = m_textEdit->textCursor().currentTable()) {
cursorEditBlock(cursor, [&] () {
@@ -611,7 +611,7 @@ void RichTextEditor::setupTableActions()
m_tableBar->addSeparator();
const QIcon addRowIcon(getIcon(Theme::Icon::addRowAfter)); //addRowAfter
m_actionAddRow = m_tableBar->addAction(addRowIcon, tr("Add Row"), [this]() {
m_actionAddRow = m_tableBar->addAction(addRowIcon, tr("Add Row"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = m_textEdit->textCursor().currentTable()) {
cursorEditBlock(cursor, [&] () {
@@ -622,7 +622,7 @@ void RichTextEditor::setupTableActions()
m_actionAddRow->setCheckable(false);
const QIcon addColumnIcon(getIcon(Theme::Icon::addColumnAfter)); //addColumnAfter
m_actionAddColumn = m_tableBar->addAction(addColumnIcon, tr("Add Column"), [this]() {
m_actionAddColumn = m_tableBar->addAction(addColumnIcon, tr("Add Column"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = m_textEdit->textCursor().currentTable()) {
cursorEditBlock(cursor, [&] () {
@@ -633,7 +633,7 @@ void RichTextEditor::setupTableActions()
m_actionAddColumn->setCheckable(false);
const QIcon removeRowIcon(getIcon(Theme::Icon::deleteRow));
m_actionRemoveRow = m_tableBar->addAction(removeRowIcon, tr("Remove Row"), [this]() {
m_actionRemoveRow = m_tableBar->addAction(removeRowIcon, tr("Remove Row"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = cursor.currentTable()) {
cursorEditBlock(cursor, [&] () {
@@ -657,7 +657,7 @@ void RichTextEditor::setupTableActions()
m_actionRemoveRow->setCheckable(false);
const QIcon removeColumnIcon(getIcon(Theme::Icon::deleteColumn));
m_actionRemoveColumn = m_tableBar->addAction(removeColumnIcon, tr("Remove Column"), [this]() {
m_actionRemoveColumn = m_tableBar->addAction(removeColumnIcon, tr("Remove Column"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = cursor.currentTable()) {
cursorEditBlock(cursor, [&] () {
@@ -681,7 +681,7 @@ void RichTextEditor::setupTableActions()
m_tableBar->addSeparator();
const QIcon mergeCellsIcon(getIcon(Theme::Icon::mergeCells));
m_actionMergeCells = m_tableBar->addAction(mergeCellsIcon, tr("Merge Cells"), [this]() {
m_actionMergeCells = m_tableBar->addAction(mergeCellsIcon, tr("Merge Cells"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = cursor.currentTable()) {
if (cursor.hasSelection()) {
@@ -694,7 +694,7 @@ void RichTextEditor::setupTableActions()
m_actionMergeCells->setCheckable(false);
const QIcon splitRowIcon(getIcon(Theme::Icon::splitRows));
m_actionSplitRow = m_tableBar->addAction(splitRowIcon, tr("Split Row"), [this]() {
m_actionSplitRow = m_tableBar->addAction(splitRowIcon, tr("Split Row"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = cursor.currentTable()) {
cursorEditBlock(cursor, [&] () {
@@ -707,7 +707,7 @@ void RichTextEditor::setupTableActions()
m_actionSplitRow->setCheckable(false);
const QIcon splitColumnIcon(getIcon(Theme::Icon::splitColumns));
m_actionSplitColumn = m_tableBar->addAction(splitColumnIcon, tr("Split Column"), [this]() {
m_actionSplitColumn = m_tableBar->addAction(splitColumnIcon, tr("Split Column"), [this] {
QTextCursor cursor = m_textEdit->textCursor();
if (QTextTable *currentTable = cursor.currentTable()) {
cursorEditBlock(cursor, [&] () {

View File

@@ -34,8 +34,8 @@ RichTextEditorProxy::RichTextEditorProxy(QObject *parent)
m_dialog->setLayout(layout);
connect(m_dialog, &QDialog::accepted, [this]() { emit accepted(); });
connect(m_dialog, &QDialog::rejected, [this]() { emit rejected(); });
connect(m_dialog, &QDialog::accepted, [this] { emit accepted(); });
connect(m_dialog, &QDialog::rejected, [this] { emit rejected(); });
}
RichTextEditorProxy::~RichTextEditorProxy()

View File

@@ -34,7 +34,7 @@ StatesEditorModel::StatesEditorModel(StatesEditorView *view)
, m_hasExtend(false)
, m_extendedStates()
{
QObject::connect(this, &StatesEditorModel::dataChanged, [this]() { emit baseStateChanged(); });
QObject::connect(this, &StatesEditorModel::dataChanged, [this] { emit baseStateChanged(); });
}
int StatesEditorModel::count() const
@@ -363,7 +363,7 @@ void StatesEditorModel::removeStateGroup()
if (m_statesEditorView->activeStatesGroupNode().isRootNode())
return;
m_statesEditorView->executeInTransaction("removeStateGroup", [this]() {
m_statesEditorView->executeInTransaction("removeStateGroup", [this] {
m_statesEditorView->activeStatesGroupNode().destroy();
});
}

View File

@@ -63,7 +63,7 @@ CanvasStyleDialog::CanvasStyleDialog(const CanvasStyle &style, QWidget *parent)
setLayout(layout);
auto emitValueChanged = [this]() {
auto emitValueChanged = [this] {
CanvasStyle out;
out.aspect = m_aspect->value();
out.thinLineWidth = m_thinLineWidth->value();

View File

@@ -82,7 +82,7 @@ TimelineForm::TimelineForm(QWidget *parent)
expressionBindingL, m_expressionBindingLineEdit, br,
}.attachTo(this);
connect(m_expressionBindingLineEdit, &QLineEdit::editingFinished, [this]() {
connect(m_expressionBindingLineEdit, &QLineEdit::editingFinished, [this] {
QTC_ASSERT(m_timeline.isValid(), return );
const QString bindingText = m_expressionBindingLineEdit->text();
@@ -107,7 +107,7 @@ TimelineForm::TimelineForm(QWidget *parent)
}
});
connect(m_idLineEdit, &QLineEdit::editingFinished, [this]() {
connect(m_idLineEdit, &QLineEdit::editingFinished, [this] {
QTC_ASSERT(m_timeline.isValid(), return );
static QString lastString;

View File

@@ -76,7 +76,7 @@ TimelineGraphicsScene::TimelineGraphicsScene(TimelineWidget *parent,
setSceneRect(m_layout->geometry());
connect(m_layout, &QGraphicsWidget::geometryChanged, this, [this]() {
connect(m_layout, &QGraphicsWidget::geometryChanged, this, [this] {
auto rect = m_layout->geometry();
setSceneRect(rect);

View File

@@ -46,7 +46,7 @@ TimelineFrameHandle::TimelineFrameHandle(TimelineItem *parent)
m_timer.setSingleShot(true);
m_timer.setInterval(15);
QObject::connect(&m_timer, &QTimer::timeout, [this]() {
QObject::connect(&m_timer, &QTimer::timeout, [this] {
if (QApplication::mouseButtons() == Qt::LeftButton)
scrollOutOfBounds();
});

View File

@@ -406,7 +406,7 @@ void TimelinePropertyItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *even
const ModelNode currentFrameNode = getModelNodeForFrame(m_frames, currentFrame());
QAction *insertAction = mainMenu.addAction(tr("Insert Keyframe"));
QObject::connect(insertAction, &QAction::triggered, [this]() {
QObject::connect(insertAction, &QAction::triggered, [this] {
timelineScene()->handleKeyframeInsertion(m_frames.target(), propertyName().toUtf8());
});
@@ -442,8 +442,8 @@ void TimelinePropertyItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *even
QMenu mainMenu;
QAction *deleteAction = mainMenu.addAction(tr("Remove Property"));
QObject::connect(deleteAction, &QAction::triggered, [this]() {
auto deleteKeyframeGroup = [this]() { timelineScene()->deleteKeyframeGroup(m_frames); };
QObject::connect(deleteAction, &QAction::triggered, [this] {
auto deleteKeyframeGroup = [this] { timelineScene()->deleteKeyframeGroup(m_frames); };
QTimer::singleShot(0, deleteKeyframeGroup);
});
@@ -627,12 +627,12 @@ void TimelineKeyframeItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *even
{
QMenu mainMenu;
QAction *removeAction = mainMenu.addAction(tr("Delete Keyframe"));
QObject::connect(removeAction, &QAction::triggered, [this]() {
QObject::connect(removeAction, &QAction::triggered, [this] {
timelineGraphicsScene()->handleKeyframeDeletion();
});
QAction *editEasingAction = mainMenu.addAction(tr("Edit Easing Curve..."));
QObject::connect(editEasingAction, &QAction::triggered, [this]() {
QObject::connect(editEasingAction, &QAction::triggered, [this] {
const QList<ModelNode> keys = Utils::transform(abstractScrollGraphicsScene()->selectedKeyframes(),
&TimelineKeyframeItem::m_frame);
@@ -640,7 +640,7 @@ void TimelineKeyframeItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *even
});
QAction *editValueAction = mainMenu.addAction(tr("Edit Keyframe..."));
QObject::connect(editValueAction, &QAction::triggered, [this]() {
QObject::connect(editValueAction, &QAction::triggered, [this] {
std::pair<qreal, qreal> timelineRange = {timelineGraphicsScene()->currentTimeline().startKeyframe(),
timelineGraphicsScene()->currentTimeline().endKeyframe()};
editValue(m_frame, timelineRange, propertyItem()->propertyName());

View File

@@ -361,25 +361,25 @@ void TimelineSectionItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event
QAction *removeAction = mainMenu.addAction(
TimelineConstants::timelineDeleteKeyframesDisplayName);
QObject::connect(removeAction, &QAction::triggered, [this]() {
QObject::connect(removeAction, &QAction::triggered, [this] {
timelineScene()->deleteAllKeyframesForTarget(m_targetNode);
});
QAction *addKeyframesAction = mainMenu.addAction(
TimelineConstants::timelineInsertKeyframesDisplayName);
QObject::connect(addKeyframesAction, &QAction::triggered, [this]() {
QObject::connect(addKeyframesAction, &QAction::triggered, [this] {
timelineScene()->insertAllKeyframesForTarget(m_targetNode);
});
QAction *copyAction = mainMenu.addAction(
TimelineConstants::timelineCopyKeyframesDisplayName);
QObject::connect(copyAction, &QAction::triggered, [this]() {
QObject::connect(copyAction, &QAction::triggered, [this] {
timelineScene()->copyAllKeyframesForTarget(m_targetNode);
});
QAction *pasteAction = mainMenu.addAction(
TimelineConstants::timelinePasteKeyframesDisplayName);
QObject::connect(pasteAction, &QAction::triggered, [this]() {
QObject::connect(pasteAction, &QAction::triggered, [this] {
timelineScene()->pasteKeyframesToTarget(m_targetNode);
});
@@ -1074,7 +1074,7 @@ void TimelineBarItem::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
QObject::connect(overrideColor, &QAction::triggered, setColor);
QAction* resetColor = menu.addAction(tr("Reset Color"));
auto reset = [this]() {
auto reset = [this] {
ModelNode target = sectionItem()->targetNode();
target.removeAuxiliaryData(timelineOverrideColorProperty);
};

View File

@@ -93,11 +93,11 @@ TimelineSettingsDialog::TimelineSettingsDialog(QWidget *parent, TimelineView *vi
auto *timelineRemoveAction = new QAction(TimelineIcons::REMOVE_TIMELINE.icon(),
tr("Remove Timeline"));
connect(timelineAddAction, &QAction::triggered, this, [this]() {
connect(timelineAddAction, &QAction::triggered, this, [this] {
setupTimelines(m_timelineView->addNewTimeline());
});
connect(timelineRemoveAction, &QAction::triggered, this, [this]() {
connect(timelineRemoveAction, &QAction::triggered, this, [this] {
QmlTimeline timeline = getTimelineFromTabWidget(m_timelineTab);
if (timeline.isValid()) {
timeline.destroy();
@@ -119,11 +119,11 @@ TimelineSettingsDialog::TimelineSettingsDialog(QWidget *parent, TimelineView *vi
animationCornerWidget->addAction(animationAddAction);
animationCornerWidget->addAction(animationRemoveAction);
connect(animationAddAction, &QAction::triggered, this, [this]() {
connect(animationAddAction, &QAction::triggered, this, [this] {
setupAnimations(m_timelineView->addAnimation(m_currentTimeline));
});
connect(animationRemoveAction, &QAction::triggered, this, [this]() {
connect(animationRemoveAction, &QAction::triggered, this, [this] {
ModelNode node = getAnimationFromTabWidget(m_animationTab);
if (node.isValid()) {
node.destroy();
@@ -156,7 +156,7 @@ TimelineSettingsDialog::TimelineSettingsDialog(QWidget *parent, TimelineView *vi
setupTimelines(QmlTimeline());
setupAnimations(m_currentTimeline);
connect(m_timelineTab, &QTabWidget::currentChanged, this, [this]() {
connect(m_timelineTab, &QTabWidget::currentChanged, this, [this] {
m_currentTimeline = getTimelineFromTabWidget(m_timelineTab);
setupAnimations(m_currentTimeline);
});

View File

@@ -359,7 +359,7 @@ void TimelineToolBar::createCenterControls()
m_currentFrame = createToolBarLineEdit(this);
addWidget(m_currentFrame);
auto emitCurrentChanged = [this]() { emit currentFrameChanged(m_currentFrame->text().toInt()); };
auto emitCurrentChanged = [this] { emit currentFrameChanged(m_currentFrame->text().toInt()); };
connect(m_currentFrame, &QLineEdit::editingFinished, emitCurrentChanged);
addSeparator();
@@ -419,7 +419,7 @@ void TimelineToolBar::createRightControls()
m_firstFrame = createToolBarLineEdit(this);
addWidget(m_firstFrame);
auto emitStartChanged = [this]() { emit startFrameChanged(m_firstFrame->text().toInt()); };
auto emitStartChanged = [this] { emit startFrameChanged(m_firstFrame->text().toInt()); };
connect(m_firstFrame, &QLineEdit::editingFinished, emitStartChanged);
addSeparator();
@@ -431,7 +431,7 @@ void TimelineToolBar::createRightControls()
tr("Zoom Out"),
QKeySequence(QKeySequence::ZoomOut));
connect(zoomOut, &QAction::triggered, [this]() {
connect(zoomOut, &QAction::triggered, [this] {
m_scale->setValue(m_scale->value() - m_scale->pageStep());
});
addAction(zoomOut);
@@ -458,7 +458,7 @@ void TimelineToolBar::createRightControls()
tr("Zoom In"),
QKeySequence(QKeySequence::ZoomIn));
connect(zoomIn, &QAction::triggered, [this]() {
connect(zoomIn, &QAction::triggered, [this] {
m_scale->setValue(m_scale->value() + m_scale->pageStep());
});
addAction(zoomIn);
@@ -470,7 +470,7 @@ void TimelineToolBar::createRightControls()
m_lastFrame = createToolBarLineEdit(this);
addWidget(m_lastFrame);
auto emitEndChanged = [this]() { emit endFrameChanged(m_lastFrame->text().toInt()); };
auto emitEndChanged = [this] { emit endFrameChanged(m_lastFrame->text().toInt()); };
connect(m_lastFrame, &QLineEdit::editingFinished, emitEndChanged);
addSeparator();

View File

@@ -24,7 +24,7 @@ TimelineToolButton::TimelineToolButton(QAction *action, QGraphicsItem *parent)
resize(TimelineConstants::toolButtonSize, TimelineConstants::toolButtonSize);
setPreferredSize(size());
setAcceptHoverEvents(true);
connect(action, &QAction::changed, this, [this]() {
connect(action, &QAction::changed, this, [this] {
setVisible(m_action->isVisible());
update();
});

View File

@@ -238,7 +238,7 @@ TimelineWidget::TimelineWidget(TimelineView *view)
connectToolbar();
auto setScrollOffset = [this]() { graphicsScene()->setScrollOffset(m_scrollbar->value()); };
auto setScrollOffset = [this] { graphicsScene()->setScrollOffset(m_scrollbar->value()); };
connect(m_scrollbar, &QSlider::valueChanged, this, setScrollOffset);
connect(graphicsScene(),
@@ -246,7 +246,7 @@ TimelineWidget::TimelineWidget(TimelineView *view)
this,
[this](const QString &message) { m_statusBar->setText(message); });
connect(m_addButton, &QPushButton::clicked, this, [this]() {
connect(m_addButton, &QPushButton::clicked, this, [this] {
m_timelineView->addNewTimelineDialog();
});
@@ -268,9 +268,7 @@ TimelineWidget::TimelineWidget(TimelineView *view)
auto playAnimation = [this](QVariant frame) { graphicsScene()->setCurrentFrame(qRound(frame.toDouble())); };
connect(m_playbackAnimation, &QVariantAnimation::valueChanged, playAnimation);
auto updatePlaybackLoopValues = [this]() {
updatePlaybackValues();
};
auto updatePlaybackLoopValues = [this] { updatePlaybackValues(); };
connect(graphicsScene()->layoutRuler(), &TimelineRulerSectionItem::playbackLoopValuesChanged, updatePlaybackLoopValues);
auto setPlaybackState = [this](QAbstractAnimation::State newState,
@@ -279,7 +277,7 @@ TimelineWidget::TimelineWidget(TimelineView *view)
};
connect(m_playbackAnimation, &QVariantAnimation::stateChanged, setPlaybackState);
auto onFinish = [this]() { graphicsScene()->setCurrentFrame(m_playbackAnimation->startValue().toInt()); };
auto onFinish = [this] { graphicsScene()->setCurrentFrame(m_playbackAnimation->startValue().toInt()); };
connect(m_playbackAnimation, &QVariantAnimation::finished, onFinish);
TimeLineNS::TimelineScrollAreaSupport::support(m_graphicsView, m_scrollbar);
@@ -297,22 +295,22 @@ void TimelineWidget::connectToolbar()
auto setZoomFactor = [this](int val) { m_graphicsScene->setZoom(val); };
connect(m_toolbar, &TimelineToolBar::scaleFactorChanged, setZoomFactor);
auto setToFirstFrame = [this]() {
auto setToFirstFrame = [this] {
graphicsScene()->setCurrentFrame(graphicsScene()->startFrame());
};
connect(m_toolbar, &TimelineToolBar::toFirstFrameTriggered, setToFirstFrame);
auto setToLastFrame = [this]() {
auto setToLastFrame = [this] {
graphicsScene()->setCurrentFrame(graphicsScene()->endFrame());
};
connect(m_toolbar, &TimelineToolBar::toLastFrameTriggered, setToLastFrame);
auto setToPreviousFrame = [this]() {
auto setToPreviousFrame = [this] {
graphicsScene()->setCurrentFrame(adjacentFrame(&previous));
};
connect(m_toolbar, &TimelineToolBar::previousFrameTriggered, setToPreviousFrame);
auto setToNextFrame = [this]() { graphicsScene()->setCurrentFrame(adjacentFrame(&next)); };
auto setToNextFrame = [this] { graphicsScene()->setCurrentFrame(adjacentFrame(&next)); };
connect(m_toolbar, &TimelineToolBar::nextFrameTriggered, setToNextFrame);
auto setCurrentFrame = [this](int frame) { graphicsScene()->setCurrentFrame(frame); };

View File

@@ -139,7 +139,7 @@ WorkspaceModel::WorkspaceModel(QObject *)
if (!dockManager)
return false;
connect(dockManager, &ADS::DockManager::workspaceListChanged, this, [this]() {
connect(dockManager, &ADS::DockManager::workspaceListChanged, this, [this] {
beginResetModel();
endResetModel();
});
@@ -323,7 +323,7 @@ ToolBarBackend::ToolBarBackend(QObject *parent)
auto editorManager = Core::EditorManager::instance();
connect(editorManager, &Core::EditorManager::documentClosed, this, [this]() {
connect(editorManager, &Core::EditorManager::documentClosed, this, [this] {
if (isInDesignMode() && Core::DocumentModel::entryCount() == 0) {
QTimer::singleShot(0,
Core::ModeManager::instance(),
@@ -340,7 +340,7 @@ ToolBarBackend::ToolBarBackend(QObject *parent)
});
});
connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this]() {
connect(Core::ModeManager::instance(), &Core::ModeManager::currentModeChanged, this, [this] {
emit isInDesignModeChanged();
emit isInEditModeChanged();
emit isInSessionModeChanged();
@@ -381,7 +381,7 @@ void ToolBarBackend::registerDeclarativeType()
void ToolBarBackend::triggerModeChange()
{
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_TOOLBAR_MODE_CHANGE);
QTimer::singleShot(0, this, [this]() { //Do not trigger mode change directly from QML
QTimer::singleShot(0, this, [this] { //Do not trigger mode change directly from QML
bool qmlFileOpen = false;
if (!projectOpened()) {

View File

@@ -63,7 +63,7 @@ TransitionEditorGraphicsScene::TransitionEditorGraphicsScene(TransitionEditorWid
setSceneRect(m_layout->geometry());
connect(m_layout, &QGraphicsWidget::geometryChanged, this, [this]() {
connect(m_layout, &QGraphicsWidget::geometryChanged, this, [this] {
auto rect = m_layout->geometry();
setSceneRect(rect);

View File

@@ -559,7 +559,7 @@ void TransitionEditorBarItem::commitPosition(const QPointF & /*point*/)
if (m_handle != Location::Undefined) {
sectionItem()
->view()
->executeInTransaction("TransitionEditorBarItem::commitPosition", [this]() {
->executeInTransaction("TransitionEditorBarItem::commitPosition", [this] {
qreal scaleFactor = rect().width() / m_oldRect.width();
qreal moved = (rect().topLeft().x() - m_oldRect.topLeft().x()) / rulerScaling();
@@ -574,7 +574,7 @@ void TransitionEditorBarItem::commitPosition(const QPointF & /*point*/)
if (m_handle != Location::Undefined) {
propertyItem()
->view()
->executeInTransaction("TransitionEditorBarItem::commitPosition", [this]() {
->executeInTransaction("TransitionEditorBarItem::commitPosition", [this] {
qreal scaleFactor = rect().width() / m_oldRect.width();
qreal moved = (rect().topLeft().x() - m_oldRect.topLeft().x()) / rulerScaling();
qreal supposedFirstFrame = qRound(moved);

View File

@@ -71,11 +71,11 @@ TransitionEditorSettingsDialog::TransitionEditorSettingsDialog(QWidget *parent,
auto *transitionRemoveAction = new QAction(TimelineIcons::REMOVE_TIMELINE.icon(),
tr("Remove Transition"));
connect(transitionAddAction, &QAction::triggered, this, [this]() {
connect(transitionAddAction, &QAction::triggered, this, [this] {
setupTransitions(m_transitionEditorView->addNewTransition());
});
connect(transitionRemoveAction, &QAction::triggered, this, [this]() {
connect(transitionRemoveAction, &QAction::triggered, this, [this] {
if (ModelNode transition = getTransitionFromTabWidget(ui->timelineTab)) {
transition.destroy();
setupTransitions({});
@@ -89,7 +89,7 @@ TransitionEditorSettingsDialog::TransitionEditorSettingsDialog(QWidget *parent,
setupTransitions({});
connect(ui->timelineTab, &QTabWidget::currentChanged, this, [this]() {
connect(ui->timelineTab, &QTabWidget::currentChanged, this, [this] {
m_currentTransition = getTransitionFromTabWidget(ui->timelineTab);
});
}

View File

@@ -182,7 +182,7 @@ void TransitionEditorToolBar::createLeftControls()
m_transitionComboBox = new QComboBox(this);
addWidgetToGroup(m_transitionComboBox);
connect(m_transitionComboBox, &QComboBox::currentTextChanged, this, [this]() {
connect(m_transitionComboBox, &QComboBox::currentTextChanged, this, [this] {
emit currentTransitionChanged(m_transitionComboBox->currentText());
});
}
@@ -242,7 +242,7 @@ void TransitionEditorToolBar::createRightControls()
tr("Zoom Out"),
QKeySequence(QKeySequence::ZoomOut));
connect(zoomOut, &QAction::triggered, [this]() {
connect(zoomOut, &QAction::triggered, [this] {
m_scale->setValue(m_scale->value() - m_scale->pageStep());
});
addAction(zoomOut);
@@ -269,7 +269,7 @@ void TransitionEditorToolBar::createRightControls()
tr("Zoom In"),
QKeySequence(QKeySequence::ZoomIn));
connect(zoomIn, &QAction::triggered, [this]() {
connect(zoomIn, &QAction::triggered, [this] {
m_scale->setValue(m_scale->value() + m_scale->pageStep());
});
addAction(zoomIn);
@@ -281,7 +281,7 @@ void TransitionEditorToolBar::createRightControls()
m_duration = createToolBarLineEdit(this);
addWidget(m_duration);
auto emitEndChanged = [this]() { emit durationChanged(m_duration->text().toInt()); };
auto emitEndChanged = [this] { emit durationChanged(m_duration->text().toInt()); };
connect(m_duration, &QLineEdit::editingFinished, emitEndChanged);
addSpacing(5);

View File

@@ -198,7 +198,7 @@ TransitionEditorWidget::TransitionEditorWidget(TransitionEditorView *view)
connectToolbar();
auto setScrollOffset = [this]() { graphicsScene()->setScrollOffset(m_scrollbar->value()); };
auto setScrollOffset = [this] { graphicsScene()->setScrollOffset(m_scrollbar->value()); };
connect(m_scrollbar, &QSlider::valueChanged, this, setScrollOffset);
connect(graphicsScene(),
@@ -206,7 +206,7 @@ TransitionEditorWidget::TransitionEditorWidget(TransitionEditorView *view)
this,
[this](const QString &message) { m_statusBar->setText(message); });
connect(m_addButton, &QPushButton::clicked, this, [this]() {
connect(m_addButton, &QPushButton::clicked, this, [this] {
m_transitionEditorView->addNewTransition();
});

View File

@@ -27,7 +27,7 @@ TransitionForm::TransitionForm(QWidget *parent)
{
ui->setupUi(this);
connect(ui->idLineEdit, &QLineEdit::editingFinished, [this]() {
connect(ui->idLineEdit, &QLineEdit::editingFinished, [this] {
QTC_ASSERT(m_transition.isValid(), return );
static QString lastString;
@@ -62,7 +62,7 @@ TransitionForm::TransitionForm(QWidget *parent)
}
});
connect(ui->listWidgetTo, &QListWidget::itemChanged, this, [this]() {
connect(ui->listWidgetTo, &QListWidget::itemChanged, this, [this] {
QTC_ASSERT(m_transition.isValid(), return );
const QmlItemNode root(m_transition.view()->rootModelNode());
QTC_ASSERT(root.isValid(), return );
@@ -86,7 +86,7 @@ TransitionForm::TransitionForm(QWidget *parent)
});
});
connect(ui->listWidgetFrom, &QListWidget::itemChanged, this, [this]() {
connect(ui->listWidgetFrom, &QListWidget::itemChanged, this, [this] {
QTC_ASSERT(m_transition.isValid(), return );
const QmlItemNode root(m_transition.view()->rootModelNode());
QTC_ASSERT(root.isValid(), return );

View File

@@ -491,7 +491,7 @@ void DesignModeWidget::aboutToShowWorkspaces()
});
QAction *resetWorkspace = menu->addAction(tr("Reset Active"));
connect(resetWorkspace, &QAction::triggered, this, [this]() {
connect(resetWorkspace, &QAction::triggered, this, [this] {
if (m_dockManager->resetWorkspacePreset(m_dockManager->activeWorkspace()->fileName()))
m_dockManager->reloadActiveWorkspace();
});

View File

@@ -499,7 +499,7 @@ void QmlDesignerProjectManager::generatePreview()
QmlDesignerProjectManager::ImageCacheData *QmlDesignerProjectManager::imageCacheData()
{
std::call_once(imageCacheFlag, [this]() {
std::call_once(imageCacheFlag, [this] {
m_imageCacheData = std::make_unique<ImageCacheData>(m_externalDependencies);
auto setTargetInImageCache =
[imageCacheData = m_imageCacheData.get()](ProjectExplorer::Target *target) {

View File

@@ -16,12 +16,12 @@ namespace QmlDesigner {
FileDownloader::FileDownloader(QObject *parent)
: QObject(parent)
{
QObject::connect(this, &FileDownloader::downloadFailed, this, [this]() {
QObject::connect(this, &FileDownloader::downloadFailed, this, [this] {
if (m_outputFile.exists())
m_outputFile.remove();
});
QObject::connect(this, &FileDownloader::downloadCanceled, this, [this]() {
QObject::connect(this, &FileDownloader::downloadCanceled, this, [this] {
if (m_outputFile.exists())
m_outputFile.remove();
});

View File

@@ -16,30 +16,30 @@ void MultiFileDownloader::setDownloader(FileDownloader *downloader)
{
m_downloader = downloader;
QObject::connect(this, &MultiFileDownloader::downloadStarting, [this]() {
QObject::connect(this, &MultiFileDownloader::downloadStarting, [this] {
m_nextFile = 0;
if (m_files.length() > 0)
m_downloader->start();
});
QObject::connect(m_downloader, &FileDownloader::progressChanged, this, [this]() {
QObject::connect(m_downloader, &FileDownloader::progressChanged, this, [this] {
double curProgress = m_downloader->progress() / 100.0;
double totalProgress = (m_nextFile + curProgress) / m_files.size();
m_progress = totalProgress * 100;
emit progressChanged();
});
QObject::connect(m_downloader, &FileDownloader::downloadFailed, this, [this]() {
QObject::connect(m_downloader, &FileDownloader::downloadFailed, this, [this] {
m_failed = true;
emit downloadFailed();
});
QObject::connect(m_downloader, &FileDownloader::downloadCanceled, this, [this]() {
QObject::connect(m_downloader, &FileDownloader::downloadCanceled, this, [this] {
m_canceled = true;
emit downloadCanceled();
});
QObject::connect(m_downloader, &FileDownloader::finishedChanged, this, [this]() {
QObject::connect(m_downloader, &FileDownloader::finishedChanged, this, [this] {
switchToNextFile();
});
}

View File

@@ -122,7 +122,7 @@ StudioSettingsPage::StudioSettingsPage()
m_pathChooserExamples->setFilePath(Utils::FilePath::fromString(Paths::examplesPathSetting()));
auto examplesResetButton = new QPushButton(tr("Reset Path"));
connect(examplesResetButton, &QPushButton::clicked, this, [this]() {
connect(examplesResetButton, &QPushButton::clicked, this, [this] {
m_pathChooserExamples->setFilePath(Paths::defaultExamplesPath());
});
@@ -141,7 +141,7 @@ StudioSettingsPage::StudioSettingsPage()
m_pathChooserBundles->setFilePath(Utils::FilePath::fromString(Paths::bundlesPathSetting()));
QPushButton *bundlesResetButton = new QPushButton(tr("Reset Path"));
connect(bundlesResetButton, &QPushButton::clicked, this, [this]() {
connect(bundlesResetButton, &QPushButton::clicked, this, [this] {
m_pathChooserBundles->setFilePath(Paths::defaultBundlesPath());
});

View File

@@ -131,11 +131,11 @@ void QmlJSOutlineWidget::setEditor(QmlJSEditorWidget *editor)
m_filterModel->setSourceModel(m_editor->qmlJsEditorDocument()->outlineModel());
m_treeView->expandAll();
connect(m_editor->qmlJsEditorDocument()->outlineModel(), &QAbstractItemModel::modelAboutToBeReset, m_treeView, [this]() {
connect(m_editor->qmlJsEditorDocument()->outlineModel(), &QAbstractItemModel::modelAboutToBeReset, m_treeView, [this] {
if (m_treeView->selectionModel())
m_treeView->selectionModel()->blockSignals(true);
});
connect(m_editor->qmlJsEditorDocument()->outlineModel(), &QAbstractItemModel::modelReset, m_treeView, [this]() {
connect(m_editor->qmlJsEditorDocument()->outlineModel(), &QAbstractItemModel::modelReset, m_treeView, [this] {
if (m_treeView->selectionModel())
m_treeView->selectionModel()->blockSignals(false);
});

View File

@@ -160,7 +160,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
action->setEnabled(ProjectManager::startupProject() != nullptr);
connect(ProjectManager::instance(), &ProjectManager::startupProjectChanged, action,
&QAction::setEnabled);
connect(action, &QAction::triggered, this, [this]() {
connect(action, &QAction::triggered, this, [this] {
if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current())
m_localeIsoCode = multiLanguageAspect->currentLocale();
bool skipDeploy = false;

View File

@@ -91,11 +91,11 @@ void QmlProfilerClientManager::createClients()
m_clientPlugin.data(), &QmlProfilerTraceClient::setRecording);
QObject::connect(this, &QmlDebug::QmlDebugConnectionManager::connectionOpened,
m_clientPlugin.data(), [this]() {
m_clientPlugin.data(), [this] {
m_clientPlugin->setRecording(m_profilerState->clientRecording());
});
QObject::connect(this, &QmlDebug::QmlDebugConnectionManager::connectionClosed,
m_clientPlugin.data(), [this]() {
m_clientPlugin.data(), [this] {
m_profilerState->setServerRecording(false);
});
}

View File

@@ -86,7 +86,7 @@ void QmlProfilerStatisticsModel::restrictToFeatures(quint64 features)
m_modelManager->replayQmlEvents(filter(std::bind(&QmlProfilerStatisticsModel::loadEvent, this,
std::placeholders::_1, std::placeholders::_2)),
std::bind(&QmlProfilerStatisticsModel::beginResetModel, this),
[this]() {
[this] {
finalize();
notesChanged(QmlProfilerStatisticsModel::s_invalidTypeId); // Reload notes
}, [this](const QString &message) {

View File

@@ -188,7 +188,7 @@ QmlProfilerTool::QmlProfilerTool()
d->m_searchButton->setEnabled(false);
connect(d->m_searchButton, &QToolButton::clicked, this, &QmlProfilerTool::showTimeLineSearch);
connect(d->m_viewContainer, &QmlProfilerViewManager::viewsCreated, this, [this]() {
connect(d->m_viewContainer, &QmlProfilerViewManager::viewsCreated, this, [this] {
d->m_searchButton->setEnabled(d->m_viewContainer->traceView()->isUsable());
});
@@ -241,7 +241,7 @@ QmlProfilerTool::QmlProfilerTool()
});
}
auto updateRecordButton = [this]() {
auto updateRecordButton = [this] {
const bool recording =
d->m_profilerState->currentState() != QmlProfilerStateManager::AppRunning
? d->m_profilerState->clientRecording() : d->m_profilerState->serverRecording();
@@ -738,7 +738,7 @@ void QmlProfilerTool::clientsDisconnected()
// ... and return to the "base" state
if (d->m_profilerState->currentState() == QmlProfilerStateManager::AppDying) {
QTimer::singleShot(0, d->m_profilerState, [this]() {
QTimer::singleShot(0, d->m_profilerState, [this] {
d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
});
}
@@ -855,7 +855,7 @@ void QmlProfilerTool::profilerStateChanged()
d->m_profilerConnections->stopRecording();
} else {
// Directly transition to idle
QTimer::singleShot(0, d->m_profilerState, [this]() {
QTimer::singleShot(0, d->m_profilerState, [this] {
d->m_profilerState->setCurrentState(QmlProfilerStateManager::Idle);
});
}

View File

@@ -74,7 +74,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
setObjectName("QmlProfiler.Timeline.Dock");
d->m_zoomControl = new Timeline::TimelineZoomControl(this);
modelManager->registerFeatures(0, QmlProfilerModelManager::QmlEventLoader(), [this]() {
modelManager->registerFeatures(0, QmlProfilerModelManager::QmlEventLoader(), [this] {
if (d->m_suspendedModels.isEmpty()) {
// Temporarily remove the models, while we're changing them
d->m_suspendedModels = d->m_modelProxy->models();
@@ -90,7 +90,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
d->m_zoomControl->setRange(start, start + (end - start) / 10);
d->m_modelProxy->setModels(d->m_suspendedModels);
d->m_suspendedModels.clear();
}, [this]() {
}, [this] {
d->m_zoomControl->clear();
if (!d->m_suspendedModels.isEmpty()) {
d->m_modelProxy->setModels(d->m_suspendedModels);

View File

@@ -87,7 +87,7 @@ QmlBuildSystem::QmlBuildSystem(Target *target)
refresh(RefreshOptions::NoFileRefresh);
updateMcuBuildStep(target, qtForMCUs());
});
connect(target->project(), &Project::projectFileIsDirty, this, [this]() {
connect(target->project(), &Project::projectFileIsDirty, this, [this] {
refresh(RefreshOptions::Project);
updateMcuBuildStep(project()->activeTarget(), qtForMCUs());
});

View File

@@ -211,7 +211,7 @@ FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const
if (!qmlRuntime.isEmpty())
return qmlRuntime;
}
auto hasDeployStep = [this]() {
auto hasDeployStep = [this] {
return target()->activeDeployConfiguration() &&
!target()->activeDeployConfiguration()->stepList()->isEmpty();
};

View File

@@ -80,7 +80,7 @@ ResourceEditorW::ResourceEditorW(const Core::Context &context,
connect(m_resourceEditor, &QrcEditor::itemActivated,
this, &ResourceEditorW::openFile);
connect(m_resourceEditor->commandHistory(), &QUndoStack::indexChanged,
m_resourceDocument, [this]() { m_resourceDocument->setShouldAutoSave(true); });
m_resourceDocument, [this] { m_resourceDocument->setShouldAutoSave(true); });
if (debugResourceEditorW)
qDebug() << "ResourceEditorW::ResourceEditorW()";
}

View File

@@ -541,7 +541,7 @@ TrimWidget::TrimWidget(const ClipInfo &clip, QWidget *parent)
noMargin(),
}.attachTo(this);
connect(m_frameSlider, &QSlider::valueChanged, this, [this]() {
connect(m_frameSlider, &QSlider::valueChanged, this, [this] {
m_currentTime->setFrame(currentFrame());
updateTrimWidgets();
emit positionChanged();

View File

@@ -41,7 +41,7 @@ NavigatorSlider::NavigatorSlider(QWidget *parent)
connect(zoomOut, &QToolButton::clicked, this, &NavigatorSlider::zoomOut);
connect(zoomIn, &QToolButton::clicked, this, &NavigatorSlider::zoomIn);
connect(m_slider, &QSlider::valueChanged, this, [=](int newValue){
connect(m_slider, &QSlider::valueChanged, this, [this](int newValue) {
emit valueChanged(newValue);
});
}

View File

@@ -885,7 +885,7 @@ void GraphicsScene::addChild(BaseItem *item)
{
if (!m_baseItems.contains(item)) {
connect(item, &BaseItem::selectedStateChanged, this, &GraphicsScene::selectionChanged);
connect(item, &BaseItem::openToDifferentView, this, [=](BaseItem *item){
connect(item, &BaseItem::openToDifferentView, this, [this](BaseItem *item) {
emit openStateView(item);
}, Qt::QueuedConnection);
m_baseItems << item;

View File

@@ -43,7 +43,7 @@ StateItem::StateItem(const QPointF &pos, BaseItem *parent)
checkWarningItems();
connect(m_stateNameItem, &TextItem::selected, this, [=](bool sel){
connect(m_stateNameItem, &TextItem::selected, this, [this](bool sel) {
setItemSelected(sel);
});
connect(m_stateNameItem, &TextItem::textChanged, this, &StateItem::updateTextPositions);

View File

@@ -50,7 +50,7 @@ TransitionItem::TransitionItem(BaseItem *parent)
<< QPointF(0, 1);
m_eventTagItem = new TagTextItem(this);
connect(m_eventTagItem, &TagTextItem::selected, this, [=](bool sel){
connect(m_eventTagItem, &TagTextItem::selected, this, [this](bool sel) {
setItemSelected(sel);
});
connect(m_eventTagItem, &TagTextItem::textReady, this, &TransitionItem::textHasChanged);

View File

@@ -115,7 +115,7 @@ DataModelDownloader::DataModelDownloader(QObject * /* parent */)
&DataModelDownloader::targetPathMustChange);
}
connect(&m_fileDownloader, &QmlDesigner::FileDownloader::finishedChanged, this, [this]() {
connect(&m_fileDownloader, &QmlDesigner::FileDownloader::finishedChanged, this, [this] {
m_started = false;
if (m_fileDownloader.finished()) {

View File

@@ -94,7 +94,7 @@ QdsNewDialog::QdsNewDialog(QWidget *parent)
deleteLater();
});
QObject::connect(m_styleModel.data(), &StyleModel::modelAboutToBeReset, this, [this]() {
QObject::connect(m_styleModel.data(), &StyleModel::modelAboutToBeReset, this, [this] {
m_qmlStyleIndex = -1;
});
}

View File

@@ -509,7 +509,7 @@ void ProjectModel::resetProjects()
void ProjectModel::delayedResetProjects()
{
QTimer::singleShot(2000, this, [this]() {
QTimer::singleShot(2000, this, [this] {
beginResetModel();
endResetModel();
m_blockOpenRecent = false;
@@ -768,7 +768,7 @@ WelcomeMode::WelcomeMode()
m_modeWidget->layout()->addWidget(m_quickWidget);
});
connect(m_dataModelDownloader, &DataModelDownloader::downloadFailed, this, [this]() {
connect(m_dataModelDownloader, &DataModelDownloader::downloadFailed, this, [this] {
m_quickWidget->setEnabled(true);
});

View File

@@ -145,7 +145,7 @@ void TerminalWidget::setupPty()
if (m_shellIntegration)
m_shellIntegration->prepareProcess(*m_process.get());
connect(m_process.get(), &Process::readyReadStandardOutput, this, [this]() {
connect(m_process.get(), &Process::readyReadStandardOutput, this, [this] {
onReadyRead(false);
});

View File

@@ -31,7 +31,7 @@ LocatorMatcherTasks BookmarkFilter::matchers()
Storage<LocatorStorage> storage;
const auto onSetup = [=] { storage->reportOutput(match(storage->input())); };
const auto onSetup = [this, storage] { storage->reportOutput(match(storage->input())); };
return {{Sync(onSetup), storage}};
}

View File

@@ -154,7 +154,7 @@ QWidget *FindInFiles::createConfigWidget()
for (const QString &dir: legacyHistory)
completer->addEntry(dir);
}
m_directory->addButton("Current", this, [this]() {
m_directory->addButton("Current", this, [this] {
const IDocument *document = EditorManager::instance()->currentDocument();
if (!document)
return;

Some files were not shown because too many files have changed in this diff Show More