From 4bdbacda75e7e11f3d55c07d489f909f2f8a1e0d Mon Sep 17 00:00:00 2001 From: wandererfan Date: Tue, 23 Aug 2022 13:50:26 -0400 Subject: [PATCH] [TD]clazy warning re 3 parameter QObject::connect --- src/Mod/TechDraw/App/DrawViewDetail.cpp | 8 +++++--- src/Mod/TechDraw/App/DrawViewPart.cpp | 15 ++++++++++----- src/Mod/TechDraw/App/DrawViewSection.cpp | 8 +++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewDetail.cpp b/src/Mod/TechDraw/App/DrawViewDetail.cpp index c21212b826..08069d59e6 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.cpp +++ b/src/Mod/TechDraw/App/DrawViewDetail.cpp @@ -216,9 +216,11 @@ void DrawViewDetail::detailExec(TopoDS_Shape& shape, return; } - connectDetailWatcher = QObject::connect(&m_detailWatcher, &QFutureWatcherBase::finished, [this] { - this->onMakeDetailFinished(); - }); + //note that &m_detailWatcher in the third parameter is not strictly required, but using the + //4 parameter signature instead of the 3 parameter signature prevents clazy warning: + //https://github.com/KDE/clazy/blob/1.11/docs/checks/README-connect-3arg-lambda.md + connectDetailWatcher = QObject::connect(&m_detailWatcher, &QFutureWatcherBase::finished, + &m_detailWatcher, [this] { this->onMakeDetailFinished(); }); m_detailFuture = QtConcurrent::run(this, &DrawViewDetail::makeDetailShape, shape, dvp, dvs); m_detailWatcher.setFuture(m_detailFuture); waitingForDetail(true); diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index f39a343ee7..745f24c762 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -386,8 +386,11 @@ TechDraw::GeometryObject* DrawViewPart::buildGeometryObject(TopoDS_Shape& shape, viewAxis); } else { //projectShape (the HLR process) runs in a separate thread since it can take a long time - connectHlrWatcher = QObject::connect(&m_hlrWatcher, &QFutureWatcherBase::finished, [this] { - this->onHlrFinished();} + //note that &m_hlrWatcher in the third parameter is not strictly required, but using the + //4 parameter signature instead of the 3 parameter signature prevents clazy warning: + //https://github.com/KDE/clazy/blob/1.11/docs/checks/README-connect-3arg-lambda.md + connectHlrWatcher = QObject::connect(&m_hlrWatcher, &QFutureWatcherBase::finished, + &m_hlrWatcher, [this] { this->onHlrFinished(); } ); m_hlrFuture = QtConcurrent::run(go, &GeometryObject::projectShape, shape, viewAxis); m_hlrWatcher.setFuture(m_hlrFuture); @@ -413,9 +416,11 @@ void DrawViewPart::onHlrFinished(void) //HLR method if (handleFaces() && !CoarseView.getValue() && !waitingForFaces()) { try { - connectFaceWatcher = QObject::connect(&m_faceWatcher, &QFutureWatcherBase::finished, [this] { - this->onFacesFinished(); - }); + //note that &m_faceWatcher in the third parameter is not strictly required, but using the + //4 parameter signature instead of the 3 parameter signature prevents clazy warning: + //https://github.com/KDE/clazy/blob/1.11/docs/checks/README-connect-3arg-lambda.md + connectFaceWatcher = QObject::connect(&m_faceWatcher, &QFutureWatcherBase::finished, + &m_faceWatcher, [this] { this->onFacesFinished(); }); m_faceFuture = QtConcurrent::run(this, &DrawViewPart::extractFaces); m_faceWatcher.setFuture(m_faceFuture); waitingForFaces(true); diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index ec8388f3ea..57523dd225 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -285,9 +285,11 @@ void DrawViewSection::sectionExec(TopoDS_Shape& baseShape) } try { - connectCutWatcher = QObject::connect(&m_cutWatcher, &QFutureWatcherBase::finished, [this] { - this->onSectionCutFinished(); - }); + //note that &m_cutWatcher in the third parameter is not strictly required, but using the + //4 parameter signature instead of the 3 parameter signature prevents clazy warning: + //https://github.com/KDE/clazy/blob/1.11/docs/checks/README-connect-3arg-lambda.md + connectCutWatcher = QObject::connect(&m_cutWatcher, &QFutureWatcherBase::finished, + &m_cutWatcher, [this] { this->onSectionCutFinished(); }); m_cutFuture = QtConcurrent::run(this, &DrawViewSection::makeSectionCut, baseShape); m_cutWatcher.setFuture(m_cutFuture); waitingForCut(true);