fix: c++20 deprecate [=]

This commit is contained in:
ppphp
2024-03-30 13:52:02 +08:00
committed by wwmayer
parent 6fbd8916ab
commit da7ee06d67
16 changed files with 21 additions and 21 deletions

View File

@@ -589,7 +589,7 @@ double toDouble(const boost::any &value)
void PropertyPlacement::setPathValue(const ObjectIdentifier &path, const boost::any &value)
{
auto updateAxis = [=](int index, double coord) {
auto updateAxis = [this](int index, double coord) {
Base::Vector3d axis;
double angle;
Base::Vector3d base = _cPos.getPosition();
@@ -601,7 +601,7 @@ void PropertyPlacement::setPathValue(const ObjectIdentifier &path, const boost::
setValue(plm);
};
auto updateYawPitchRoll = [=](int index, double angle) {
auto updateYawPitchRoll = [this](int index, double angle) {
Base::Vector3d base = _cPos.getPosition();
Base::Rotation rot = _cPos.getRotation();
double yaw, pitch, roll;
@@ -1076,7 +1076,7 @@ void PropertyRotation::getPaths(std::vector<ObjectIdentifier> &paths) const
void PropertyRotation::setPathValue(const ObjectIdentifier &path, const boost::any &value)
{
auto updateAxis = [=](int index, double coord) {
auto updateAxis = [this](int index, double coord) {
Base::Vector3d axis;
double angle;
_rot.getRawValue(axis, angle);

View File

@@ -105,7 +105,7 @@ DlgCustomKeyboardImp::DlgCustomKeyboardImp( QWidget* parent )
QObject::connect(ui->shortcutTimeout, qOverload<int>(&QSpinBox::valueChanged), timer, [=](int) {
timer->start(100);
});
QObject::connect(timer, &QTimer::timeout, [=]() {
QObject::connect(timer, &QTimer::timeout, [this]() {
ui->shortcutTimeout->onSave();
});
}

View File

@@ -195,7 +195,7 @@ bool DlgSettingsColorGradientImp::isOutInvisible() const
void DlgSettingsColorGradientImp::setRange(float fMin, float fMax)
{
auto toString = [=](float value, int decimals) {
auto toString = [this](float value, int decimals) {
int pos = 0;
while (decimals > 0) {
QString str = QLocale().toString(value, 'g', decimals--);

View File

@@ -654,7 +654,7 @@ void DlgSettingsUI::init()
QObject::connect(DockOverlayAnimationCurve, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &DlgSettingsUI::onCurveChange);
QObject::connect(timer, &QTimer::timeout, [=]() {
QObject::connect(timer, &QTimer::timeout, [this]() {
if (animator1->state() != QAbstractAnimation::Running) {
this->setOffset1(1);
this->a1 = this->b1 = 0;

View File

@@ -546,7 +546,7 @@ void QuantitySpinBox::openFormulaDialog()
if (d->checkRangeInExpression) {
box->setRange(d->minimum, d->maximum);
}
QObject::connect(box, &Gui::Dialog::DlgExpressionInput::finished, [=]() {
QObject::connect(box, &Gui::Dialog::DlgExpressionInput::finished, [this, box]() {
if (box->result() == QDialog::Accepted)
setExpression(box->getExpression());
else if (box->discardedFormula())

View File

@@ -52,7 +52,7 @@ ExpressionSpinBox::ExpressionSpinBox(QAbstractSpinBox* sb)
{
lineedit = spinbox->findChild<QLineEdit*>();
makeLabel(lineedit);
QObject::connect(iconLabel, &ExpressionLabel::clicked, [=]() {
QObject::connect(iconLabel, &ExpressionLabel::clicked, [this]() {
this->openFormulaDialog();
});
}
@@ -183,7 +183,7 @@ void ExpressionSpinBox::openFormulaDialog()
unit = qprop->getUnit();
auto box = new Gui::Dialog::DlgExpressionInput(getPath(), getExpression(), unit, spinbox);
QObject::connect(box, &Gui::Dialog::DlgExpressionInput::finished, [=]() {
QObject::connect(box, &Gui::Dialog::DlgExpressionInput::finished, [this, box]() {
if (box->result() == QDialog::Accepted)
setExpression(box->getExpression());
else if (box->discardedFormula())

View File

@@ -5050,7 +5050,7 @@ void DocumentObjectItem::restoreBackground() {
void DocumentObjectItem::setHighlight(bool set, Gui::HighlightMode high) {
QFont f = this->font(0);
auto highlight = [=](const QColor& col) {
auto highlight = [this, set](const QColor& col) {
if (set)
this->setBackground(0, col);
else

View File

@@ -1714,7 +1714,7 @@ ButtonGroup::ButtonGroup(QObject *parent)
QButtonGroup::setExclusive(false);
connect(this, qOverload<QAbstractButton *>(&QButtonGroup::buttonClicked),
[=](QAbstractButton *button) {
[this](QAbstractButton *button) {
if (exclusive()) {
const auto btns = buttons();
for (auto btn : btns) {

View File

@@ -108,10 +108,10 @@ TaskFemConstraintBearing::TaskFemConstraintBearing(ViewProviderFemConstraint* Co
qOverload<double>(&QDoubleSpinBox::valueChanged),
this,
&TaskFemConstraintBearing::onDistanceChanged);
connect(ui->buttonReference, &QPushButton::pressed, this, [=] {
connect(ui->buttonReference, &QPushButton::pressed, this, [this] {
onButtonReference(true);
});
connect(ui->buttonLocation, &QPushButton::pressed, this, [=] {
connect(ui->buttonLocation, &QPushButton::pressed, this, [this] {
onButtonLocation(true);
});
connect(ui->checkAxial, &QCheckBox::toggled, this, &TaskFemConstraintBearing::onCheckAxial);

View File

@@ -179,7 +179,7 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(
this,
&TaskFemConstraintFluidBoundary::onThermalBoundaryTypeChanged);
connect(ui->buttonDirection, &QPushButton::pressed, this, [=] {
connect(ui->buttonDirection, &QPushButton::pressed, this, [this] {
onButtonDirection(true);
});
connect(ui->checkReverse,

View File

@@ -62,7 +62,7 @@ TaskFemConstraintGear::TaskFemConstraintGear(ViewProviderFemConstraint* Constrai
qOverload<double>(&QDoubleSpinBox::valueChanged),
this,
&TaskFemConstraintGear::onForceAngleChanged);
connect(ui->buttonDirection, &QPushButton::pressed, this, [=] {
connect(ui->buttonDirection, &QPushButton::pressed, this, [this] {
onButtonDirection(true);
});
connect(ui->checkReversed, &QCheckBox::toggled, this, &TaskFemConstraintGear::onCheckReversed);

View File

@@ -420,7 +420,7 @@ void ImpExpDxfRead::OnReadText(const Base::Vector3d& point,
// Note that our parameters do not contain all the information needed to properly orient the
// text. As a result the text will always appear on the XY plane
if (m_importAnnotations) {
auto makeText = [=](const Base::Matrix4D& transform) -> App::FeaturePython* {
auto makeText = [this, rotation, point, text, height](const Base::Matrix4D& transform) -> App::FeaturePython* {
PyObject* draftModule = getDraftModule();
if (draftModule != nullptr) {
Base::Matrix4D localTransform;
@@ -537,7 +537,7 @@ void ImpExpDxfRead::OnReadDimension(const Base::Vector3d& start,
double /*rotation*/)
{
if (m_importAnnotations) {
auto makeDimension = [=](const Base::Matrix4D& transform) -> App::FeaturePython* {
auto makeDimension = [this, start, end, point](const Base::Matrix4D& transform) -> App::FeaturePython* {
PyObject* draftModule = getDraftModule();
if (draftModule != nullptr) {
// TODO: Capture and apply OCSOrientationTransform to OCS coordinates

View File

@@ -229,7 +229,7 @@ void TaskShapeBinder::removeFromListWidget(QListWidget* widget, QString itemstr)
void TaskShapeBinder::onSelectionChanged(const Gui::SelectionChanges& msg)
{
auto setObjectLabel = [=](const Gui::SelectionChanges& msg) {
auto setObjectLabel = [this](const Gui::SelectionChanges& msg) {
App::DocumentObject* obj = msg.Object.getObject();
if (obj) {
ui->baseEdit->setText(QString::fromStdString(obj->Label.getStrValue()));

View File

@@ -587,7 +587,7 @@ protected:
/*avoidMouseCursor = */ true))
.get();
QObject::connect(parameter, &Gui::EditableDatumLabel::valueChanged, [=](double value) {
QObject::connect(parameter, &Gui::EditableDatumLabel::valueChanged, [this, parameter, i](double value) {
parameter->setColor(colorManager.dimConstrColor);
onViewValueChanged(i, value);
});

View File

@@ -108,7 +108,7 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
connect(ui->projection, qOverload<const QString&>(&QComboBox::currentIndexChanged), this, &TaskProjGroup::projectionTypeChanged);
#else
connect(ui->projection, qOverload<int>(&QComboBox::currentIndexChanged), this, [=](int index) {
connect(ui->projection, qOverload<int>(&QComboBox::currentIndexChanged), this, [this](int index) {
projectionTypeChanged(ui->projection->itemText(index));
});
#endif

View File

@@ -210,7 +210,7 @@ MRichTextEdit::MRichTextEdit(QWidget *parent, QString textIn) : QWidget(parent)
connect(f_fontsize, qOverload<const QString&>(&QComboBox::currentIndexChanged),
this, &MRichTextEdit::textSize);
#else
connect(f_fontsize, qOverload<int>(&QComboBox::currentIndexChanged), this, [=](int index) {
connect(f_fontsize, qOverload<int>(&QComboBox::currentIndexChanged), this, [this](int index) {
textSize(f_fontsize->itemText(index));
});
#endif