modernize C++: avoid bind

In many cases std::bind() is kept because the code is much simpler
This commit is contained in:
wmayer
2023-08-08 19:10:49 +02:00
committed by wwmayer
parent c765d64891
commit 948cbfccd9
80 changed files with 240 additions and 30 deletions

View File

@@ -257,8 +257,10 @@ void ShapeBinder::onSettingDocument()
{
App::Document* document = getDocument();
if (document) {
//NOLINTBEGIN
this->connectDocumentChangedObject = document->signalChangedObject.connect(std::bind
(&ShapeBinder::slotChangedObject, this, sp::_1, sp::_2));
//NOLINTEND
}
}
@@ -833,9 +835,11 @@ void SubShapeBinder::onChanged(const App::Property* prop) {
else if (contextDoc != Context.getValue()->getDocument()
|| !connRecomputedObj.connected())
{
//NOLINTBEGIN
contextDoc = Context.getValue()->getDocument();
connRecomputedObj = contextDoc->signalRecomputedObject.connect(
std::bind(&SubShapeBinder::slotRecomputedObject, this, sp::_1));
//NOLINTEND
}
}
else if (!isRestoring()) {

View File

@@ -250,8 +250,10 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare
ui->ThreadDepth->bind(pcHole->ThreadDepth);
ui->CustomThreadClearance->bind(pcHole->CustomThreadClearance);
//NOLINTBEGIN
connectPropChanged = App::GetApplication().signalChangePropertyEditor.connect(
std::bind(&TaskHoleParameters::changedObject, this, sp::_1, sp::_2));
//NOLINTEND
this->groupLayout()->addWidget(proxy);
}

View File

@@ -49,7 +49,11 @@ TaskTransformedMessages::TaskTransformedMessages(ViewProviderTransformed *transf
this->groupLayout()->addWidget(proxy);
ui->labelTransformationStatus->setText(transformedView->getMessage());
connectionDiagnosis = transformedView->signalDiagnosis.connect(std::bind(&PartDesignGui::TaskTransformedMessages::slotDiagnosis, this, sp::_1));
//NOLINTBEGIN
connectionDiagnosis = transformedView->signalDiagnosis.connect(
std::bind(&PartDesignGui::TaskTransformedMessages::slotDiagnosis, this, sp::_1)
);
//NOLINTEND
}
TaskTransformedMessages::~TaskTransformedMessages()

View File

@@ -91,11 +91,13 @@ void ViewProviderBody::attach(App::DocumentObject *pcFeat)
assert ( adoc );
assert ( gdoc );
//NOLINTBEGIN
connectChangedObjectApp = adoc->signalChangedObject.connect (
std::bind ( &ViewProviderBody::slotChangedObjectApp, this, sp::_1, sp::_2) );
connectChangedObjectGui = gdoc->signalChangedObject.connect (
std::bind ( &ViewProviderBody::slotChangedObjectGui, this, sp::_1, sp::_2) );
//NOLINTEND
}
// TODO on activating the body switch to the "Through" mode (2015-09-05, Fat-Zer)
@@ -131,7 +133,9 @@ void ViewProviderBody::setupContextMenu(QMenu* menu, QObject* receiver, const ch
Q_UNUSED(member);
Gui::ActionFunction* func = new Gui::ActionFunction(menu);
QAction* act = menu->addAction(tr("Toggle active body"));
func->trigger(act, std::bind(&ViewProviderBody::doubleClicked, this));
func->trigger(act, [this]() {
this->doubleClicked();
});
Gui::ViewProviderGeometryObject::setupContextMenu(menu, receiver, member); // clazy:exclude=skipped-base-method
}

View File

@@ -442,11 +442,13 @@ void Workbench::activated()
if(App::GetApplication().GetUserParameter().GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign")->GetBool("SwitchToTask", true))
Gui::Control().showTaskView();
//NOLINTBEGIN
// Let us be notified when a document is activated, so that we can update the ActivePartObject
activeDoc = Gui::Application::Instance->signalActiveDocument.connect(std::bind(&Workbench::slotActiveDocument, this, sp::_1));
createDoc = App::GetApplication().signalNewDocument.connect(std::bind(&Workbench::slotNewDocument, this, sp::_1));
finishDoc = App::GetApplication().signalFinishRestoreDocument.connect(std::bind(&Workbench::slotFinishRestoreDocument, this, sp::_1));
deleteDoc = App::GetApplication().signalDeleteDocument.connect(std::bind(&Workbench::slotDeleteDocument, this, sp::_1));
//NOLINTEND
}
void Workbench::deactivated()

View File

@@ -48,12 +48,14 @@ WorkflowManager::WorkflowManager() {
slotFinishRestoreDocument ( *doc );
}
//NOLINTBEGIN
connectNewDocument = App::GetApplication().signalNewDocument.connect(
std::bind( &WorkflowManager::slotNewDocument, this, sp::_1 ) );
connectFinishRestoreDocument = App::GetApplication().signalFinishRestoreDocument.connect(
std::bind( &WorkflowManager::slotFinishRestoreDocument, this, sp::_1 ) );
connectDeleteDocument = App::GetApplication().signalDeleteDocument.connect(
std::bind( &WorkflowManager::slotDeleteDocument, this, sp::_1 ) );
//NOLINTEND
}
WorkflowManager::~WorkflowManager() {