modernize C++: avoid bind
In many cases std::bind() is kept because the code is much simpler
This commit is contained in:
@@ -207,12 +207,14 @@ struct ShapeCache {
|
||||
if(inited)
|
||||
return;
|
||||
inited = true;
|
||||
//NOLINTBEGIN
|
||||
App::GetApplication().signalDeleteDocument.connect(
|
||||
std::bind(&ShapeCache::slotDeleteDocument, this, sp::_1));
|
||||
App::GetApplication().signalDeletedObject.connect(
|
||||
std::bind(&ShapeCache::slotClear, this, sp::_1));
|
||||
App::GetApplication().signalChangedObject.connect(
|
||||
std::bind(&ShapeCache::slotChanged, this, sp::_1,sp::_2));
|
||||
//NOLINTEND
|
||||
}
|
||||
|
||||
void slotDeleteDocument(const App::Document &doc) {
|
||||
|
||||
@@ -93,10 +93,12 @@ DlgBooleanOperation::DlgBooleanOperation(QWidget* parent)
|
||||
this, &DlgBooleanOperation::currentItemChanged);
|
||||
connect(ui->secondShape, &QTreeWidget::currentItemChanged,
|
||||
this, &DlgBooleanOperation::currentItemChanged);
|
||||
//NOLINTBEGIN
|
||||
this->connectNewObject = App::GetApplication().signalNewObject.connect(std::bind
|
||||
(&DlgBooleanOperation::slotCreatedObject, this, sp::_1));
|
||||
this->connectModObject = App::GetApplication().signalChangedObject.connect(std::bind
|
||||
(&DlgBooleanOperation::slotChangedObject, this, sp::_1, sp::_2));
|
||||
//NOLINTEND
|
||||
findShapes();
|
||||
}
|
||||
|
||||
|
||||
@@ -244,10 +244,12 @@ DlgFilletEdges::DlgFilletEdges(FilletType type, Part::FilletBase* fillet, QWidge
|
||||
Gui::Selection().addSelectionGate(d->selection);
|
||||
|
||||
d->fillet = fillet;
|
||||
//NOLINTBEGIN
|
||||
d->connectApplicationDeletedObject = App::GetApplication().signalDeletedObject
|
||||
.connect(std::bind(&DlgFilletEdges::onDeleteObject, this, sp::_1));
|
||||
d->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument
|
||||
.connect(std::bind(&DlgFilletEdges::onDeleteDocument, this, sp::_1));
|
||||
//NOLINTEND
|
||||
// set tree view with three columns
|
||||
FilletRadiusModel* model = new FilletRadiusModel(this);
|
||||
connect(model, &FilletRadiusModel::toggleCheckState,
|
||||
|
||||
@@ -224,9 +224,11 @@ TaskAttacher::TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidge
|
||||
selectMapMode(eMapMode(pcAttach->MapMode.getValue()));
|
||||
updatePreview();
|
||||
|
||||
//NOLINTBEGIN
|
||||
// connect object deletion with slot
|
||||
auto bnd1 = std::bind(&TaskAttacher::objectDeleted, this, sp::_1);
|
||||
auto bnd2 = std::bind(&TaskAttacher::documentDeleted, this, sp::_1);
|
||||
//NOLINTEND
|
||||
Gui::Document* document = Gui::Application::Instance->getDocument(ViewProvider->getObject()->getDocument());
|
||||
connectDelObject = document->signalDeletedObject.connect(bnd1);
|
||||
connectDelDocument = document->signalDeleteDocument.connect(bnd2);
|
||||
|
||||
@@ -94,7 +94,9 @@ struct MeasureInfo {
|
||||
{
|
||||
if(!_MeasureInfoInited) {
|
||||
_MeasureInfoInited = true;
|
||||
//NOLINTBEGIN
|
||||
App::GetApplication().signalDeleteDocument.connect(std::bind(slotDeleteDocument, sp::_1));
|
||||
//NOLINTEND
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -251,12 +251,14 @@ FaceColors::FaceColors(ViewProviderPartExt* vp, QWidget* parent)
|
||||
FaceSelection* gate = new FaceSelection(d->vp->getObject());
|
||||
Gui::Selection().addSelectionGate(gate);
|
||||
|
||||
//NOLINTBEGIN
|
||||
d->connectDelDoc = Gui::Application::Instance->signalDeleteDocument.connect(std::bind
|
||||
(&FaceColors::slotDeleteDocument, this, sp::_1));
|
||||
d->connectDelObj = Gui::Application::Instance->signalDeletedObject.connect(std::bind
|
||||
(&FaceColors::slotDeleteObject, this, sp::_1));
|
||||
d->connectUndoDoc = d->doc->signalUndoDocument.connect(std::bind
|
||||
(&FaceColors::slotUndoDocument, this, sp::_1));
|
||||
//NOLINTEND
|
||||
}
|
||||
|
||||
FaceColors::~FaceColors()
|
||||
|
||||
@@ -118,7 +118,9 @@ void ViewProviderAttachExtension::extensionSetupContextMenu(QMenu* menu, QObject
|
||||
QAction* act = menu->addAction(QObject::tr("Attachment editor"));
|
||||
if (Gui::Control().activeDialog())
|
||||
act->setDisabled(true);
|
||||
func->trigger(act, std::bind(&ViewProviderAttachExtension::showAttachmentEditor, this));
|
||||
func->trigger(act, [this](){
|
||||
this->showAttachmentEditor();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ void ViewProviderPrimitive::setupContextMenu(QMenu* menu, QObject* receiver, con
|
||||
Gui::ActionFunction* func = new Gui::ActionFunction(menu);
|
||||
QAction* act = menu->addAction(QObject::tr("Edit %1").arg(QString::fromUtf8(getObject()->Label.getValue())));
|
||||
act->setData(QVariant((int)ViewProvider::Default));
|
||||
func->trigger(act, std::bind(&ViewProviderPrimitive::startDefaultEditMode, this));
|
||||
func->trigger(act, [this](){
|
||||
this->startDefaultEditMode();
|
||||
});
|
||||
|
||||
ViewProviderPart::setupContextMenu(menu, receiver, member);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,9 @@ void ViewProviderSplineExtension::extensionSetupContextMenu(QMenu* menu, QObject
|
||||
QAction* act = menu->addAction(QObject::tr("Show control points"));
|
||||
act->setCheckable(true);
|
||||
act->setChecked(ControlPoints.getValue());
|
||||
func->toggle(act, std::bind(&ViewProviderSplineExtension::toggleControlPoints, this, sp::_1));
|
||||
func->toggle(act, [this](bool on) {
|
||||
this->toggleControlPoints(on);
|
||||
});
|
||||
}
|
||||
|
||||
void ViewProviderSplineExtension::extensionUpdateData(const App::Property* prop)
|
||||
|
||||
Reference in New Issue
Block a user