From c252e611f23ec58f050ad8b15b8d20128c92760b Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 13 Jan 2023 16:30:58 +0100 Subject: [PATCH] Mesh: move to new style connect() --- src/Mod/Mesh/Gui/DlgDecimating.cpp | 8 ++++---- src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp | 6 +++--- src/Mod/Mesh/Gui/DlgSmoothing.cpp | 21 +++++++++++++-------- src/Mod/Mesh/Gui/RemeshGmsh.cpp | 18 +++++++++--------- src/Mod/Mesh/Gui/RemoveComponents.cpp | 4 ++-- src/Mod/Mesh/Gui/SegmentationBestFit.cpp | 4 ++-- src/Mod/MeshPart/Gui/Tessellation.cpp | 2 +- 7 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/Mod/Mesh/Gui/DlgDecimating.cpp b/src/Mod/Mesh/Gui/DlgDecimating.cpp index 8466ef4c42..93bc333875 100644 --- a/src/Mod/Mesh/Gui/DlgDecimating.cpp +++ b/src/Mod/Mesh/Gui/DlgDecimating.cpp @@ -79,8 +79,8 @@ void DlgDecimating::on_checkAbsolueNumber_toggled(bool on) ui->groupBoxTolerance->setDisabled(on); if (on) { - disconnect(ui->sliderReduction, SIGNAL(valueChanged(int)), ui->spinBoxReduction, SLOT(setValue(int))); - disconnect(ui->spinBoxReduction, SIGNAL(valueChanged(int)), ui->sliderReduction, SLOT(setValue(int))); + disconnect(ui->sliderReduction, qOverload(&QSlider::valueChanged), ui->spinBoxReduction, &QSpinBox::setValue); + disconnect(ui->spinBoxReduction, qOverload(&QSpinBox::valueChanged), ui->sliderReduction, &QSlider::setValue); ui->spinBoxReduction->setRange(1, numberOfTriangles); ui->spinBoxReduction->setValue(numberOfTriangles * (1.0 - reduction())); ui->spinBoxReduction->setSuffix(QString()); @@ -91,8 +91,8 @@ void DlgDecimating::on_checkAbsolueNumber_toggled(bool on) ui->spinBoxReduction->setValue(ui->sliderReduction->value()); ui->spinBoxReduction->setSuffix(QString::fromLatin1("%")); ui->checkAbsolueNumber->setText(tr("Absolute number")); - connect(ui->sliderReduction, SIGNAL(valueChanged(int)), ui->spinBoxReduction, SLOT(setValue(int))); - connect(ui->spinBoxReduction, SIGNAL(valueChanged(int)), ui->sliderReduction, SLOT(setValue(int))); + connect(ui->sliderReduction, qOverload(&QSlider::valueChanged), ui->spinBoxReduction, &QSpinBox::setValue); + connect(ui->spinBoxReduction, qOverload(&QSpinBox::valueChanged), ui->sliderReduction, &QSlider::setValue); } } diff --git a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp index 8786f45150..4f8b24b77c 100644 --- a/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp +++ b/src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp @@ -54,7 +54,7 @@ CleanupHandler::CleanupHandler() : QObject(qApp) { // connect to lstWindowClosed signal - connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(cleanup())); + connect(qApp, &QApplication::lastWindowClosed, this, &CleanupHandler::cleanup); } // The lastWindowClosed signal will be emitted recursively and before the cleanup slot is finished @@ -129,8 +129,8 @@ DlgEvaluateMeshImp::DlgEvaluateMeshImp(QWidget* parent, Qt::WindowFlags fl) d->ui.line_8->setFrameShape(QFrame::HLine); d->ui.line_8->setFrameShadow(QFrame::Sunken); - connect(d->ui.buttonBox, SIGNAL (helpRequested()), - Gui::getMainWindow(), SLOT (whatsThis())); + connect(d->ui.buttonBox, &QDialogButtonBox::helpRequested, + Gui::getMainWindow(), &Gui::MainWindow::whatsThis); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/Mod/Mesh/Evaluation"); diff --git a/src/Mod/Mesh/Gui/DlgSmoothing.cpp b/src/Mod/Mesh/Gui/DlgSmoothing.cpp index f1d08ac27f..919d422e79 100644 --- a/src/Mod/Mesh/Gui/DlgSmoothing.cpp +++ b/src/Mod/Mesh/Gui/DlgSmoothing.cpp @@ -48,8 +48,13 @@ DlgSmoothing::DlgSmoothing(QWidget* parent) bg = new QButtonGroup(this); bg->addButton(ui->radioButtonTaubin, 0); bg->addButton(ui->radioButtonLaplace, 1); - connect(bg, SIGNAL(buttonClicked(int)), - this, SLOT(method_clicked(int))); +#if QT_VERSION < QT_VERSION_CHECK(5,15,0) + connect(bg, qOverload(&QButtonGroup::buttonClicked), + this, &DlgSmoothing::method_clicked); +#else + connect(bg, &QButtonGroup::idClicked, + this, &DlgSmoothing::method_clicked); +#endif ui->labelLambda->setText(QString::fromUtf8("\xce\xbb")); ui->labelMu->setText(QString::fromUtf8("\xce\xbc")); @@ -123,10 +128,10 @@ SmoothingDialog::SmoothingDialog(QWidget* parent, Qt::WindowFlags fl) QDialogButtonBox* buttonBox = new QDialogButtonBox(this); buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); - connect(buttonBox, SIGNAL(accepted()), - this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), - this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, + this, &SmoothingDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, + this, &SmoothingDialog::reject); hboxLayout->addWidget(widget); hboxLayout->addWidget(buttonBox); @@ -156,8 +161,8 @@ TaskSmoothing::TaskSmoothing() tasksel->hide(); Content.push_back(tasksel); - connect(widget, SIGNAL(toggledSelection(bool)), - tasksel, SLOT(setVisible(bool))); + connect(widget, &DlgSmoothing::toggledSelection, + tasksel, &Gui::TaskView::TaskBox::setVisible); } TaskSmoothing::~TaskSmoothing() diff --git a/src/Mod/Mesh/Gui/RemeshGmsh.cpp b/src/Mod/Mesh/Gui/RemeshGmsh.cpp index 3aca345bd6..5da156ee28 100644 --- a/src/Mod/Mesh/Gui/RemeshGmsh.cpp +++ b/src/Mod/Mesh/Gui/RemeshGmsh.cpp @@ -73,15 +73,15 @@ GmshWidget::GmshWidget(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl) , d(new Private(parent)) { - connect(&d->gmsh, SIGNAL(started()), this, SLOT(started())); - connect(&d->gmsh, SIGNAL(finished(int, QProcess::ExitStatus)), - this, SLOT(finished(int, QProcess::ExitStatus))); - connect(&d->gmsh, SIGNAL(errorOccurred(QProcess::ProcessError)), - this, SLOT(errorOccurred(QProcess::ProcessError))); - connect(&d->gmsh, SIGNAL(readyReadStandardError()), - this, SLOT(readyReadStandardError())); - connect(&d->gmsh, SIGNAL(readyReadStandardOutput()), - this, SLOT(readyReadStandardOutput())); + connect(&d->gmsh, &QProcess::started, this, &GmshWidget::started); + connect(&d->gmsh, qOverload(&QProcess::finished), + this, &GmshWidget::finished); + connect(&d->gmsh, &QProcess::errorOccurred, + this, &GmshWidget::errorOccurred); + connect(&d->gmsh, &QProcess::readyReadStandardError, + this, &GmshWidget::readyReadStandardError); + connect(&d->gmsh, &QProcess::readyReadStandardOutput, + this, &GmshWidget::readyReadStandardOutput); d->ui.setupUi(this); d->ui.fileChooser->onRestore(); diff --git a/src/Mod/Mesh/Gui/RemoveComponents.cpp b/src/Mod/Mesh/Gui/RemoveComponents.cpp index 147b66ca02..2ae0ce541c 100644 --- a/src/Mod/Mesh/Gui/RemoveComponents.cpp +++ b/src/Mod/Mesh/Gui/RemoveComponents.cpp @@ -175,8 +175,8 @@ RemoveComponentsDialog::RemoveComponentsDialog(QWidget* parent, Qt::WindowFlags buttonBox->addButton(MeshGui::TaskRemoveComponents::tr("Invert"), QDialogButtonBox::ActionRole); - connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), - this, SLOT(clicked(QAbstractButton*))); + connect(buttonBox, &QDialogButtonBox::clicked, + this, &RemoveComponentsDialog::clicked); hboxLayout->addWidget(widget); hboxLayout->addWidget(buttonBox); diff --git a/src/Mod/Mesh/Gui/SegmentationBestFit.cpp b/src/Mod/Mesh/Gui/SegmentationBestFit.cpp index f050efde30..2ac9b4bd2d 100644 --- a/src/Mod/Mesh/Gui/SegmentationBestFit.cpp +++ b/src/Mod/Mesh/Gui/SegmentationBestFit.cpp @@ -221,8 +221,8 @@ ParametersDialog::ParametersDialog(std::vector& val, FitParameter* fitPar ++index; } - QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + QObject::connect(buttonBox, &QDialogButtonBox::accepted, this, &ParametersDialog::accept); + QObject::connect(buttonBox, &QDialogButtonBox::rejected, this, &ParametersDialog::reject); QMetaObject::connectSlotsByName(this); Gui::SelectionObject obj(mesh); diff --git a/src/Mod/MeshPart/Gui/Tessellation.cpp b/src/Mod/MeshPart/Gui/Tessellation.cpp index 11d94c908f..520968a5c1 100644 --- a/src/Mod/MeshPart/Gui/Tessellation.cpp +++ b/src/Mod/MeshPart/Gui/Tessellation.cpp @@ -56,7 +56,7 @@ Tessellation::Tessellation(QWidget* parent) { ui->setupUi(this); gmsh = new Mesh2ShapeGmsh(this); - connect(gmsh, SIGNAL(processed()), this, SLOT(gmshProcessed())); + connect(gmsh, &Mesh2ShapeGmsh::processed, this, &Tessellation::gmshProcessed); ui->stackedWidget->addTab(gmsh, tr("Gmsh"));