From 002685c153ff109b09c359c3ebcb838e8cc48df2 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 27 Oct 2023 11:30:23 +0200 Subject: [PATCH] rm unnecessary qOverload --- GUI/View/Device/AxisPropertyForm.cpp | 4 +- GUI/View/Device/FootprintForm.cpp | 18 +++--- GUI/View/Device/SphericalAxisForm.cpp | 3 +- GUI/View/Instrument/AlphaScanEditor.cpp | 2 +- GUI/View/Instrument/DetectorEditor.cpp | 56 +++++++++---------- .../MaterialEditor/MaterialEditorDialog.cpp | 6 +- GUI/View/Numeric/ComboUtil.h | 2 +- GUI/View/Numeric/NumWidgetUtil.cpp | 5 +- 8 files changed, 43 insertions(+), 53 deletions(-) diff --git a/GUI/View/Device/AxisPropertyForm.cpp b/GUI/View/Device/AxisPropertyForm.cpp index e928d85619f..82fc0f515e4 100644 --- a/GUI/View/Device/AxisPropertyForm.cpp +++ b/GUI/View/Device/AxisPropertyForm.cpp @@ -45,7 +45,7 @@ AxisPropertyForm::AxisPropertyForm(QWidget* parent, const QString& groupTitle, connect(collapser, &GroupBoxCollapser::toggled, this, [this](bool b) { m_axisProperty->setExpandGroupBox(b); }); - connect(m_minSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged), [this](double v) { + connect(m_minSpinBox, &DoubleSpinBox::baseValueChanged, [this](double v) { if (m_axisProperty->min() != v) { m_axisProperty->setMin(v); emit dataChanged(); @@ -56,7 +56,7 @@ AxisPropertyForm::AxisPropertyForm(QWidget* parent, const QString& groupTitle, } }); - connect(m_maxSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged), [this](double v) { + connect(m_maxSpinBox, &DoubleSpinBox::baseValueChanged, [this](double v) { if (m_axisProperty->max() != v) { m_axisProperty->setMax(v); emit dataChanged(); diff --git a/GUI/View/Device/FootprintForm.cpp b/GUI/View/Device/FootprintForm.cpp index 42d1e297d0a..ffde0a26f25 100644 --- a/GUI/View/Device/FootprintForm.cpp +++ b/GUI/View/Device/FootprintForm.cpp @@ -55,19 +55,17 @@ void FootprintForm::updateFootprintWidgets() auto* spinbox = new DoubleSpinBox(square->squareFootprintValue()); spinbox->setSingleStep(0.01); m_formLayout->addRow("Width ratio:", spinbox); - connect(spinbox, qOverload<double>(&DoubleSpinBox::baseValueChanged), - [this, square](double newValue) { - square->setSquareFootprintValue(newValue); - emit dataChanged(); - }); + connect(spinbox, &DoubleSpinBox::baseValueChanged, [this, square](double newValue) { + square->setSquareFootprintValue(newValue); + emit dataChanged(); + }); } else if (auto* gauss = dynamic_cast<FootprintGaussianItem*>(footprintItem)) { auto* spinbox = new DoubleSpinBox(gauss->gaussianFootprintValue()); spinbox->setSingleStep(0.01); m_formLayout->addRow("Width ratio:", spinbox); - connect(spinbox, qOverload<double>(&DoubleSpinBox::baseValueChanged), - [this, gauss](double newValue) { - gauss->setGaussianFootprintValue(newValue); - emit dataChanged(); - }); + connect(spinbox, &DoubleSpinBox::baseValueChanged, [this, gauss](double newValue) { + gauss->setGaussianFootprintValue(newValue); + emit dataChanged(); + }); } } diff --git a/GUI/View/Device/SphericalAxisForm.cpp b/GUI/View/Device/SphericalAxisForm.cpp index 1ba8d0f4263..d868bdf848f 100644 --- a/GUI/View/Device/SphericalAxisForm.cpp +++ b/GUI/View/Device/SphericalAxisForm.cpp @@ -23,8 +23,7 @@ SphericalAxisForm::SphericalAxisForm(QFormLayout* form, QWidget* parent) { m_nbinsSpinBox = new SafeSpinBox; m_nbinsSpinBox->setRange(1, 65536); - connect(m_nbinsSpinBox, qOverload<int>(&QSpinBox::valueChanged), this, - &SphericalAxisForm::onNbinsValueChanged); + connect(m_nbinsSpinBox, &QSpinBox::valueChanged, this, &SphericalAxisForm::onNbinsValueChanged); form->addRow("# scan points:", m_nbinsSpinBox); m_minimumSpinBox = new ScientificSpinBox(parent); diff --git a/GUI/View/Instrument/AlphaScanEditor.cpp b/GUI/View/Instrument/AlphaScanEditor.cpp index 4f7891d3dc6..4454a5fd761 100644 --- a/GUI/View/Instrument/AlphaScanEditor.cpp +++ b/GUI/View/Instrument/AlphaScanEditor.cpp @@ -56,7 +56,7 @@ AlphaScanEditor::AlphaScanEditor(QWidget* parent, GrazingScanItem* item, bool al onAxisTypeSelected(idx); // enable currently selected axis typeComboBox->setEnabled(m_item->pointwiseAlphaAxisDefined()); - connect(typeComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, + connect(typeComboBox, &QComboBox::currentIndexChanged, this, &AlphaScanEditor::onAxisTypeSelected); //... distribution plot diff --git a/GUI/View/Instrument/DetectorEditor.cpp b/GUI/View/Instrument/DetectorEditor.cpp index a7706a95264..8e12a743058 100644 --- a/GUI/View/Instrument/DetectorEditor.cpp +++ b/GUI/View/Instrument/DetectorEditor.cpp @@ -102,19 +102,17 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem) auto* xAxisNbinsSpinBox = new SafeSpinBox; xAxisNbinsSpinBox->setRange(1, 65536); xAxisNbinsSpinBox->setValue(detectorItem->xSize()); - connect(xAxisNbinsSpinBox, qOverload<int>(&QSpinBox::valueChanged), - [this, detectorItem](int newValue) { - detectorItem->setXSize(newValue); - emit dataChanged(); - }); + connect(xAxisNbinsSpinBox, &QSpinBox::valueChanged, [this, detectorItem](int newValue) { + detectorItem->setXSize(newValue); + emit dataChanged(); + }); xAxisFormLayout->addRow("# bins:", xAxisNbinsSpinBox); auto* widthSpinBox = new DoubleSpinBox(detectorItem->width()); - connect(widthSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged), - [this, detectorItem](double newValue) { - detectorItem->setWidth(newValue); - emit dataChanged(); - }); + connect(widthSpinBox, &DoubleSpinBox::baseValueChanged, [this, detectorItem](double newValue) { + detectorItem->setWidth(newValue); + emit dataChanged(); + }); xAxisFormLayout->addRow("Width (mm):", widthSpinBox); ::createSpinBox(xAxisFormLayout, detectorItem->u0(), this); @@ -129,19 +127,17 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem) auto* yAxisNbinsSpinBox = new SafeSpinBox; yAxisNbinsSpinBox->setRange(1, 65536); yAxisNbinsSpinBox->setValue(detectorItem->ySize()); - connect(yAxisNbinsSpinBox, qOverload<int>(&QSpinBox::valueChanged), - [this, detectorItem](int newValue) { - detectorItem->setYSize(newValue); - emit dataChanged(); - }); + connect(yAxisNbinsSpinBox, &QSpinBox::valueChanged, [this, detectorItem](int newValue) { + detectorItem->setYSize(newValue); + emit dataChanged(); + }); yAxisFormLayout->addRow("# bins:", yAxisNbinsSpinBox); auto* heightSpinBox = new DoubleSpinBox(detectorItem->height()); - connect(heightSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged), - [this, detectorItem](double newValue) { - detectorItem->setHeight(newValue); - emit dataChanged(); - }); + connect(heightSpinBox, &DoubleSpinBox::baseValueChanged, [this, detectorItem](double newValue) { + detectorItem->setHeight(newValue); + emit dataChanged(); + }); yAxisFormLayout->addRow("Height (mm):", heightSpinBox); ::createSpinBox(yAxisFormLayout, detectorItem->v0(), this); @@ -166,17 +162,15 @@ DetectorEditor::DetectorEditor(QWidget* parent, GISASInstrumentItem* instrItem) auto* sigmaXSpinBox = GUI::Util::createDoubleSpinBoxRow(layout, p->sigmaX()); auto* sigmaYSpinBox = GUI::Util::createDoubleSpinBoxRow(layout, p->sigmaY()); - connect(sigmaXSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged), - [parent, p](double newValue) { - p->setSigmaX(newValue); - emit parent->dataChanged(); - }); - - connect(sigmaYSpinBox, qOverload<double>(&DoubleSpinBox::baseValueChanged), - [parent, p](double newValue) { - p->setSigmaY(newValue); - emit parent->dataChanged(); - }); + connect(sigmaXSpinBox, &DoubleSpinBox::baseValueChanged, [parent, p](double newValue) { + p->setSigmaX(newValue); + emit parent->dataChanged(); + }); + + connect(sigmaYSpinBox, &DoubleSpinBox::baseValueChanged, [parent, p](double newValue) { + p->setSigmaY(newValue); + emit parent->dataChanged(); + }); } }; diff --git a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp index a2e08ec77b6..fa7983085c1 100644 --- a/GUI/View/MaterialEditor/MaterialEditorDialog.cpp +++ b/GUI/View/MaterialEditor/MaterialEditorDialog.cpp @@ -113,13 +113,13 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, QWidget* parent) connect(m_ui->nameEdit, &QLineEdit::textEdited, [&](const QString& t) { m_model->setMaterialItemName(currentIndex(), t); }); - connect(m_ui->xSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), + connect(m_ui->xSpinBox, &QDoubleSpinBox::valueChanged, [&](double value) { m_model->setX(currentIndex(), value); }); - connect(m_ui->ySpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), + connect(m_ui->ySpinBox, &QDoubleSpinBox::valueChanged, [&](double value) { m_model->setY(currentIndex(), value); }); - connect(m_ui->zSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), + connect(m_ui->zSpinBox, &QDoubleSpinBox::valueChanged, [&](double value) { m_model->setZ(currentIndex(), value); }); connect(m_ui->deltaEdit, &QLineEdit::editingFinished, diff --git a/GUI/View/Numeric/ComboUtil.h b/GUI/View/Numeric/ComboUtil.h index 3fb5d3f6b34..bc56f83c15c 100644 --- a/GUI/View/Numeric/ComboUtil.h +++ b/GUI/View/Numeric/ComboUtil.h @@ -72,7 +72,7 @@ QComboBox* createComboBoxFromProperty(SelectionProperty<T>& d, if (!isScrollable) WheelEventEater::install(combo); - QObject::connect(combo, qOverload<int>(&QComboBox::currentIndexChanged), [&d, slot](int index) { + QObject::connect(combo, &QComboBox::currentIndexChanged, [&d, slot](int index) { d.setCurrentIndex(index); if (slot) slot(index); diff --git a/GUI/View/Numeric/NumWidgetUtil.cpp b/GUI/View/Numeric/NumWidgetUtil.cpp index d5ab12025a5..f028bd63830 100644 --- a/GUI/View/Numeric/NumWidgetUtil.cpp +++ b/GUI/View/Numeric/NumWidgetUtil.cpp @@ -81,7 +81,7 @@ QSpinBox* GUI::Util::createIntSpinbox(function<int()> getter, function<void(int) if (!easyScrollable) WheelEventEater::install(spin); - QObject::connect(spin, qOverload<int>(&QSpinBox::valueChanged), [=] { slot(spin->value()); }); + QObject::connect(spin, &QSpinBox::valueChanged, [=] { slot(spin->value()); }); if (updaters) (*updaters) << [=]() { @@ -111,8 +111,7 @@ QDoubleSpinBox* GUI::Util::createDoubleSpinbox(function<double()> getter, if (!easyScrollable) WheelEventEater::install(spin); - QObject::connect(spin, qOverload<double>(&QDoubleSpinBox::valueChanged), - [=] { slot(spin->value()); }); + QObject::connect(spin, &QDoubleSpinBox::valueChanged, [=] { slot(spin->value()); }); if (updaters) (*updaters) << [=]() { -- GitLab