From f793ca2cd360065758862d5324b09fa438dbfb1f Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 20 Dec 2023 18:00:02 +0100 Subject: [PATCH] in connect-to-lambda statements, omit pointless 'this' argument --- GUI/Model/Model/FitParameterModel.cpp | 2 +- GUI/Model/Sample/MaterialModel.cpp | 2 +- GUI/View/Access/DataAccessWidget.cpp | 2 +- GUI/View/Combo/ItemComboWidget.cpp | 2 +- GUI/View/Fit/FitSessionManager.cpp | 2 +- GUI/View/FitControl/RunFitControlWidget.cpp | 4 ++-- GUI/View/JobControl/JobListModel.cpp | 6 +++--- GUI/View/JobControl/JobListing.cpp | 2 +- GUI/View/JobControl/JobPropertiesTableModel.cpp | 8 ++++---- GUI/View/JobControl/JobPropertiesWidget.cpp | 2 +- GUI/View/Main/ActionManager.cpp | 2 +- GUI/View/Plotter/ProjectionsPlot.cpp | 2 +- GUI/View/Plotter/SpecularPlot.cpp | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/GUI/Model/Model/FitParameterModel.cpp b/GUI/Model/Model/FitParameterModel.cpp index b11177b6f8d..2395bf750c1 100644 --- a/GUI/Model/Model/FitParameterModel.cpp +++ b/GUI/Model/Model/FitParameterModel.cpp @@ -33,7 +33,7 @@ FitParameterModel::FitParameterModel(FitParameterContainerItem* fitParContainer, connectContainer(); connect(fitParContainer, &QObject::destroyed, this, [this] { m_fitParameterContainer = nullptr; }); - connect(jobItem, &QObject::destroyed, this, [this] { m_jobItem = nullptr; }); + connect(jobItem, &QObject::destroyed, [this] { m_jobItem = nullptr; }); } Qt::ItemFlags FitParameterModel::flags(const QModelIndex& index) const diff --git a/GUI/Model/Sample/MaterialModel.cpp b/GUI/Model/Sample/MaterialModel.cpp index b10de3d454c..cd95e6d3644 100644 --- a/GUI/Model/Sample/MaterialModel.cpp +++ b/GUI/Model/Sample/MaterialModel.cpp @@ -86,7 +86,7 @@ MaterialItem* MaterialModel::addMaterialItem(MaterialItem* materialItem, bool si ASSERT(materialItem); materialItem->disconnect(this); m_materials << materialItem; - connect(materialItem, &MaterialItem::dataChanged, this, [this] { emit materialChanged(); }); + connect(materialItem, &MaterialItem::dataChanged, [this] { emit materialChanged(); }); if (signalAdding) emit materialAddedOrRemoved(); diff --git a/GUI/View/Access/DataAccessWidget.cpp b/GUI/View/Access/DataAccessWidget.cpp index ddf6fb5f9cb..73337bb843a 100644 --- a/GUI/View/Access/DataAccessWidget.cpp +++ b/GUI/View/Access/DataAccessWidget.cpp @@ -32,7 +32,7 @@ void DataAccessWidget::setBaseItem(QObject* item) ASSERT(jobItem() || realItem()); disconnect(m_item, &QObject::destroyed, this, nullptr); - connect(m_item, &QObject::destroyed, this, [this] { m_item = nullptr; }); + connect(m_item, &QObject::destroyed, [this] { m_item = nullptr; }); } QList<QAction*> DataAccessWidget::actionList() diff --git a/GUI/View/Combo/ItemComboWidget.cpp b/GUI/View/Combo/ItemComboWidget.cpp index e271420d096..a20d6a8134d 100644 --- a/GUI/View/Combo/ItemComboWidget.cpp +++ b/GUI/View/Combo/ItemComboWidget.cpp @@ -97,7 +97,7 @@ void ItemComboWidget::setTheItem(QObject* item) ASSERT(jobItem() || realItem()); disconnect(m_item, &QObject::destroyed, this, nullptr); - connect(m_item, &QObject::destroyed, this, [this] { m_item = nullptr; }); + connect(m_item, &QObject::destroyed, [this] { m_item = nullptr; }); setToolbarVisible(!itemPresentation().isEmpty()); m_toolbar->setPresentationList(presentationList(), activePresentationList()); diff --git a/GUI/View/Fit/FitSessionManager.cpp b/GUI/View/Fit/FitSessionManager.cpp index 9c61b822b91..d78afeb5ed2 100644 --- a/GUI/View/Fit/FitSessionManager.cpp +++ b/GUI/View/Fit/FitSessionManager.cpp @@ -48,7 +48,7 @@ FitSessionController* FitSessionManager::sessionController(JobItem* jobItem) FitSessionController* FitSessionManager::createController(JobItem* jobItem) { - connect(jobItem, &JobItem::destroyed, this, [this, jobItem] { removeController(jobItem); }); + connect(jobItem, &JobItem::destroyed, [this, jobItem] { removeController(jobItem); }); auto* result = new FitSessionController(this); result->setJobItem(jobItem); diff --git a/GUI/View/FitControl/RunFitControlWidget.cpp b/GUI/View/FitControl/RunFitControlWidget.cpp index a5cb0aed3df..3184e43f839 100644 --- a/GUI/View/FitControl/RunFitControlWidget.cpp +++ b/GUI/View/FitControl/RunFitControlWidget.cpp @@ -86,8 +86,8 @@ RunFitControlWidget::RunFitControlWidget() setLayout(layout); connect(m_startButton, &QPushButton::clicked, [&] { emit startFittingPushed(); }); - connect(m_stopButton, &QPushButton::clicked, this, [&] { emit stopFittingPushed(); }); - connect(m_updButton, &QPushButton::clicked, this, [&] { emit updFromTreePushed(); }); + connect(m_stopButton, &QPushButton::clicked, [&] { emit stopFittingPushed(); }); + connect(m_updButton, &QPushButton::clicked, [&] { emit updFromTreePushed(); }); connect(m_intervalSlider, &QSlider::valueChanged, this, &RunFitControlWidget::onSliderValueChanged); diff --git a/GUI/View/JobControl/JobListModel.cpp b/GUI/View/JobControl/JobListModel.cpp index e2a27f28b83..cd23b0ab128 100644 --- a/GUI/View/JobControl/JobListModel.cpp +++ b/GUI/View/JobControl/JobListModel.cpp @@ -121,13 +121,13 @@ void JobListModel::onJobAdded() void JobListModel::enableJobNotification(JobItem* job) { // name - connect(job, &JobItem::jobNameChanged, this, [this, job] { emitJobListModelChanged(job); }); + connect(job, &JobItem::jobNameChanged, [this, job] { emitJobListModelChanged(job); }); // status - connect(job, &JobItem::jobStatusChanged, this, [this, job] { emitJobListModelChanged(job); }); + connect(job, &JobItem::jobStatusChanged, [this, job] { emitJobListModelChanged(job); }); // progress - connect(job, &JobItem::jobProgressChanged, this, [this, job] { emitJobListModelChanged(job); }); + connect(job, &JobItem::jobProgressChanged, [this, job] { emitJobListModelChanged(job); }); } void JobListModel::disableJobNotification(JobItem* job) diff --git a/GUI/View/JobControl/JobListing.cpp b/GUI/View/JobControl/JobListing.cpp index 700d217d28f..ec4ff3790cf 100644 --- a/GUI/View/JobControl/JobListing.cpp +++ b/GUI/View/JobControl/JobListing.cpp @@ -219,7 +219,7 @@ void JobListing::showContextMenu(const QPoint&) for (const QModelIndex& index : indexes) { JobItem* job = m_model->jobItemForIndex(index); QAction* action = m_equalizeMenu->addAction(QString("to ").append(job->jobName())); - connect(action, &QAction::triggered, this, [this, job] { equalizeSelectedToJob(job); }); + connect(action, &QAction::triggered, [this, job] { equalizeSelectedToJob(job); }); } m_equalizeMenu->setEnabled(true); } else diff --git a/GUI/View/JobControl/JobPropertiesTableModel.cpp b/GUI/View/JobControl/JobPropertiesTableModel.cpp index 99bfce7a308..4c3814cd863 100644 --- a/GUI/View/JobControl/JobPropertiesTableModel.cpp +++ b/GUI/View/JobControl/JobPropertiesTableModel.cpp @@ -144,25 +144,25 @@ void JobPropertiesTableModel::setJobItem(JobItem* jobItem) void JobPropertiesTableModel::notifyJobPropertyChange() { // name - connect(m_item, &JobItem::jobNameChanged, this, [this](const QString&) { + connect(m_item, &JobItem::jobNameChanged, [this](const QString&) { emit dataChanged(index(Row::Name, Column::Value), index(Row::Name, Column::Value), {Qt::DisplayRole, Qt::EditRole}); }); // status - connect(m_item, &JobItem::jobStatusChanged, this, [this](const JobStatus) { + connect(m_item, &JobItem::jobStatusChanged, [this](const JobStatus) { emit dataChanged(index(Row::Status, Column::Value), index(Row::Status, Column::Value), {Qt::DisplayRole, Qt::EditRole}); }); // begin time - connect(m_item, &JobItem::jobBeginTimeChanged, this, [this](const QDateTime&) { + connect(m_item, &JobItem::jobBeginTimeChanged, [this](const QDateTime&) { emit dataChanged(index(Row::Begin, Column::Value), index(Row::Begin, Column::Value), {Qt::DisplayRole, Qt::EditRole}); }); // end time and duration - connect(m_item, &JobItem::jobEndTimeChanged, this, [this](const QDateTime&) { + connect(m_item, &JobItem::jobEndTimeChanged, [this](const QDateTime&) { emit dataChanged(index(Row::End, Column::Value), index(Row::Duration, Column::Value), {Qt::DisplayRole, Qt::EditRole}); }); diff --git a/GUI/View/JobControl/JobPropertiesWidget.cpp b/GUI/View/JobControl/JobPropertiesWidget.cpp index d329927bc93..007c4d1d6b2 100644 --- a/GUI/View/JobControl/JobPropertiesWidget.cpp +++ b/GUI/View/JobControl/JobPropertiesWidget.cpp @@ -103,7 +103,7 @@ void JobPropertiesWidget::setJobItem(JobItem* jobItem) void JobPropertiesWidget::notifyJobPropertyChange() { - connect(m_jobItem, &JobItem::jobCommentsChanged, this, [this](const QString&) { + connect(m_jobItem, &JobItem::jobCommentsChanged, [this](const QString&) { if (m_jobItem && m_jobItem->comments() != m_commentsEditor->toPlainText()) { m_commentsEditor->blockSignals(true); m_commentsEditor->setPlainText(m_jobItem->comments()); diff --git a/GUI/View/Main/ActionManager.cpp b/GUI/View/Main/ActionManager.cpp index d1e8cf35120..770d0e24293 100644 --- a/GUI/View/Main/ActionManager.cpp +++ b/GUI/View/Main/ActionManager.cpp @@ -245,7 +245,7 @@ void ActionManager::onAboutToShowSettingsMenu() radioButton->setStyleSheet(""); action->setDefaultWidget(radioButton); radioButton->setChecked(appSettings->currentStyle() == style); - connect(radioButton, &QRadioButton::toggled, this, [style] { + connect(radioButton, &QRadioButton::toggled, [style] { appSettings->setStyleToUse(style); appSettings->loadStyle(style); }); diff --git a/GUI/View/Plotter/ProjectionsPlot.cpp b/GUI/View/Plotter/ProjectionsPlot.cpp index 4ab70d7f31f..7b64817ae77 100644 --- a/GUI/View/Plotter/ProjectionsPlot.cpp +++ b/GUI/View/Plotter/ProjectionsPlot.cpp @@ -51,7 +51,7 @@ void ProjectionsPlot::setData2DItem(Data2DItem* item) // set nullptr at destruction if (m_data2DItem) { disconnect(m_data2DItem, &DataItem::destroyed, this, nullptr); - connect(m_data2DItem, &DataItem::destroyed, this, [this] { m_data2DItem = nullptr; }); + connect(m_data2DItem, &DataItem::destroyed, [this] { m_data2DItem = nullptr; }); } clearAll(); diff --git a/GUI/View/Plotter/SpecularPlot.cpp b/GUI/View/Plotter/SpecularPlot.cpp index 76f9dd60c74..c902444a524 100644 --- a/GUI/View/Plotter/SpecularPlot.cpp +++ b/GUI/View/Plotter/SpecularPlot.cpp @@ -56,7 +56,7 @@ void SpecularPlot::setData1DItems(const QList<Data1DItem*>& items) for (auto*& item : m_data_items) if (item) { disconnect(item, &DataItem::destroyed, this, nullptr); - connect(item, &DataItem::destroyed, this, [&item] { item = nullptr; }); + connect(item, &DataItem::destroyed, [&item] { item = nullptr; }); } initPlot(); -- GitLab