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

@@ -849,7 +849,7 @@ void PropertySheet::insertRows(int row, int count)
boost::copy( data | boost::adaptors::map_keys, std::back_inserter(keys));
/* Sort them */
std::sort(keys.begin(), keys.end(), std::bind(&PropertySheet::rowSortFunc, this, sp::_1, sp::_2));
std::sort(keys.begin(), keys.end(), std::bind(&PropertySheet::rowSortFunc, this, sp::_1, sp::_2)); //NOLINT
MoveCellsExpressionVisitor<PropertySheet> visitor(*this,
CellAddress(row, CellAddress::MAX_COLUMNS), count, 0);
@@ -1047,7 +1047,7 @@ void PropertySheet::removeColumns(int col, int count)
boost::copy(data | boost::adaptors::map_keys, std::back_inserter(keys));
/* Sort them */
std::sort(keys.begin(), keys.end(), std::bind(&PropertySheet::colSortFunc, this, sp::_1, sp::_2));
std::sort(keys.begin(), keys.end(), std::bind(&PropertySheet::colSortFunc, this, sp::_1, sp::_2)); //NOLINT
MoveCellsExpressionVisitor<PropertySheet> visitor(*this,
CellAddress(CellAddress::MAX_ROWS, col + count - 1), 0, -count);
@@ -1414,8 +1414,10 @@ void PropertySheet::slotChangedObject(const App::DocumentObject &obj, const App:
}
void PropertySheet::onAddDep(App::DocumentObject *obj) {
//NOLINTBEGIN
depConnections[obj] = obj->signalChanged.connect(std::bind(
&PropertySheet::slotChangedObject, this, sp::_1, sp::_2));
//NOLINTEND
}
void PropertySheet::onRemoveDep(App::DocumentObject *obj) {

View File

@@ -45,10 +45,12 @@ namespace sp = std::placeholders;
SheetModel::SheetModel(Sheet* _sheet, QObject* parent) : QAbstractTableModel(parent), sheet(_sheet)
{
//NOLINTBEGIN
cellUpdatedConnection =
sheet->cellUpdated.connect(bind(&SheetModel::cellUpdated, this, sp::_1));
rangeUpdatedConnection =
sheet->rangeUpdated.connect(bind(&SheetModel::rangeUpdated, this, sp::_1));
//NOLINTEND
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Spreadsheet");

View File

@@ -98,8 +98,10 @@ SheetView::SheetView(Gui::Document *pcDocument, App::DocumentObject *docObj, QWi
connect(ui->cellAlias, &ExpressionLineEdit::editingFinished, this, [this]() {confirmAliasChanged(ui->cellAlias->text()); });
connect(ui->cellAlias, &LineEdit::textEdited, this, &SheetView::aliasChanged);
//NOLINTBEGIN
columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, sp::_1, sp::_2));
rowHeightChangedConnection = sheet->rowHeightChanged.connect(bind(&SheetView::resizeRow, this, sp::_1, sp::_2));
//NOLINTEND
connect( model, &QAbstractItemModel::dataChanged, this, &SheetView::modelUpdated);