From 70061abf77f1f0ece7d66348237bfa92f262feab Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 13 Jan 2023 15:57:18 +0100 Subject: [PATCH] Inspection: move to new style connect() --- src/Base/FutureWatcherProgress.h | 2 +- src/Mod/Inspection/App/InspectionFeature.cpp | 13 +++++++------ src/Mod/Inspection/Gui/VisualInspection.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Base/FutureWatcherProgress.h b/src/Base/FutureWatcherProgress.h index ad45a60530..2a37cdd7df 100644 --- a/src/Base/FutureWatcherProgress.h +++ b/src/Base/FutureWatcherProgress.h @@ -44,7 +44,7 @@ public: FutureWatcherProgress& operator= (const FutureWatcherProgress&) = delete; FutureWatcherProgress& operator= (FutureWatcherProgress&&) = delete; -private Q_SLOTS: +public Q_SLOTS: void progressValueChanged(int value); private: diff --git a/src/Mod/Inspection/App/InspectionFeature.cpp b/src/Mod/Inspection/App/InspectionFeature.cpp index 0208d99e80..44384a8575 100644 --- a/src/Mod/Inspection/App/InspectionFeature.cpp +++ b/src/Mod/Inspection/App/InspectionFeature.cpp @@ -822,12 +822,12 @@ App::DocumentObjectExecReturn* Feature::execute(void) //future.waitForFinished(); // blocks the GUI Base::FutureWatcherProgress progress("Inspecting...", actual->countPoints()); QFutureWatcher watcher; - QObject::connect(&watcher, SIGNAL(progressValueChanged(int)), - &progress, SLOT(progressValueChanged(int))); + QObject::connect(&watcher, &QFutureWatcher::progressValueChanged, + &progress, &Base::FutureWatcherProgress::progressValueChanged); // keep it responsive during computation QEventLoop loop; - QObject::connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::connect(&watcher, &QFutureWatcher::finished, &loop, &QEventLoop::quit); watcher.setFuture(future); loop.exec(); @@ -908,11 +908,12 @@ App::DocumentObjectExecReturn* Feature::execute(void) // Setup progress bar Base::FutureWatcherProgress progress("Inspecting...", actual->countPoints()); QFutureWatcher watcher; - QObject::connect(&watcher, SIGNAL(progressValueChanged(int)), - &progress, SLOT(progressValueChanged(int))); + QObject::connect(&watcher, &QFutureWatcher::progressValueChanged, + &progress, &Base::FutureWatcherProgress::progressValueChanged); // Keep UI responsive during computation QEventLoop loop; - QObject::connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit())); + QObject::connect(&watcher, &QFutureWatcher::finished, + &loop, &QEventLoop::quit); watcher.setFuture(future); loop.exec(); res = future.result(); diff --git a/src/Mod/Inspection/Gui/VisualInspection.cpp b/src/Mod/Inspection/Gui/VisualInspection.cpp index 7fb0317901..d8bf609bf7 100644 --- a/src/Mod/Inspection/Gui/VisualInspection.cpp +++ b/src/Mod/Inspection/Gui/VisualInspection.cpp @@ -83,12 +83,12 @@ VisualInspection::VisualInspection(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl), ui(new Ui_VisualInspection) { ui->setupUi(this); - connect(ui->treeWidgetActual, SIGNAL(itemClicked(QTreeWidgetItem*, int)), - this, SLOT(onActivateItem(QTreeWidgetItem*))); - connect(ui->treeWidgetNominal, SIGNAL(itemClicked(QTreeWidgetItem*, int)), - this, SLOT(onActivateItem(QTreeWidgetItem*))); - connect(ui->buttonBox, SIGNAL(helpRequested()), - Gui::getMainWindow(), SLOT(whatsThis())); + connect(ui->treeWidgetActual, &QTreeWidget::itemClicked, + this, &VisualInspection::onActivateItem); + connect(ui->treeWidgetNominal, &QTreeWidget::itemClicked, + this, &VisualInspection::onActivateItem); + connect(ui->buttonBox, &QDialogButtonBox::helpRequested, + Gui::getMainWindow(), &Gui::MainWindow::whatsThis); //FIXME: Not used yet ui->textLabel2->hide();