Inspection: move to new style connect()

This commit is contained in:
wmayer
2023-01-13 15:57:18 +01:00
parent a621ad81f4
commit 70061abf77
3 changed files with 14 additions and 13 deletions

View File

@@ -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:

View File

@@ -822,12 +822,12 @@ App::DocumentObjectExecReturn* Feature::execute(void)
//future.waitForFinished(); // blocks the GUI
Base::FutureWatcherProgress progress("Inspecting...", actual->countPoints());
QFutureWatcher<float> watcher;
QObject::connect(&watcher, SIGNAL(progressValueChanged(int)),
&progress, SLOT(progressValueChanged(int)));
QObject::connect(&watcher, &QFutureWatcher<float>::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<DistanceInspectionRMS> watcher;
QObject::connect(&watcher, SIGNAL(progressValueChanged(int)),
&progress, SLOT(progressValueChanged(int)));
QObject::connect(&watcher, &QFutureWatcher<DistanceInspectionRMS>::progressValueChanged,
&progress, &Base::FutureWatcherProgress::progressValueChanged);
// Keep UI responsive during computation
QEventLoop loop;
QObject::connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit()));
QObject::connect(&watcher, &QFutureWatcher<DistanceInspectionRMS>::finished,
&loop, &QEventLoop::quit);
watcher.setFuture(future);
loop.exec();
res = future.result();

View File

@@ -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();