[TD]use new style QObject::connect

This commit is contained in:
Wanderer Fan
2022-08-21 10:14:19 -04:00
committed by WandererFan
parent 5bc07eddd1
commit 81949d0817
25 changed files with 44 additions and 58 deletions

View File

@@ -22,9 +22,9 @@
#ifndef _TechDraw_DrawLeaderLine_h_
#define _TechDraw_DrawLeaderLine_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
# include <App/DocumentObject.h>
# include <App/FeaturePython.h>
# include <App/PropertyLinks.h>
@@ -38,7 +38,6 @@ namespace TechDraw
class TechDrawExport DrawLeaderLine : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawLeaderLine);
Q_OBJECT
public:
DrawLeaderLine();

View File

@@ -51,7 +51,6 @@ class DrawProjGroupItem;
class TechDrawExport DrawProjGroup : public TechDraw::DrawViewCollection
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawProjGroup);
Q_OBJECT
public:
/// Constructor

View File

@@ -22,8 +22,8 @@
#ifndef _DrawProjGroupItem_h_
#define _DrawProjGroupItem_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <gp_Ax2.hxx>
@@ -53,7 +53,6 @@ class DrawProjGroup;
class TechDrawExport DrawProjGroupItem : public TechDraw::DrawViewPart
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawProjGroupItem);
Q_OBJECT
public:
/// Constructor

View File

@@ -36,7 +36,6 @@ namespace TechDraw
class TechDrawExport DrawRichAnno : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawRichAnno);
Q_OBJECT
public:
DrawRichAnno();

View File

@@ -601,8 +601,6 @@ PyObject *DrawView::getPyObject(void)
return Py::new_reference_to(PythonObject);
}
#include <Mod/TechDraw/App/moc_DrawView.cpp>
// Python Drawing feature ---------------------------------------------------------
namespace App {

View File

@@ -46,7 +46,7 @@ class DrawLeaderLine;
/** Base class of all View Features in the drawing module
*/
class TechDrawExport DrawView : public App::DocumentObject, public QObject
class TechDrawExport DrawView : public App::DocumentObject
{
Q_DECLARE_TR_FUNCTIONS(TechDraw::DrawView)
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawView);

View File

@@ -40,7 +40,6 @@ namespace TechDraw
class TechDrawExport DrawViewAnnotation : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewAnnotation);
Q_OBJECT
public:
/// Constructor

View File

@@ -22,8 +22,8 @@
#ifndef _DrawViewArch_h_
#define _DrawViewArch_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <App/DocumentObject.h>
#include <App/PropertyLinks.h>
@@ -38,8 +38,7 @@ namespace TechDraw
class TechDrawExport DrawViewArch : public TechDraw::DrawViewSymbol
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewArch);
Q_OBJECT
public:
/// Constructor
DrawViewArch();

View File

@@ -22,8 +22,8 @@
#ifndef _TechDraw_DrawViewBalloon_h_
#define _TechDraw_DrawViewBalloon_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <App/DocumentObject.h>
#include <App/PropertyLinks.h>
@@ -44,7 +44,6 @@ class DrawViewPart;
class TechDrawExport DrawViewBalloon : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewBalloon);
Q_OBJECT
public:
/// Constructor

View File

@@ -40,7 +40,6 @@ namespace TechDraw
class TechDrawExport DrawViewClip: public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewClip);
Q_OBJECT
public:
/// Constructor

View File

@@ -39,7 +39,6 @@ namespace TechDraw
class TechDrawExport DrawViewCollection : public DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewCollection);
Q_OBJECT
public:
App::PropertyLinkList Views;

View File

@@ -216,7 +216,9 @@ void DrawViewDetail::detailExec(TopoDS_Shape& shape,
return;
}
QObject::connect(&m_detailWatcher, SIGNAL(finished()), this, SLOT(onMakeDetailFinished()));
connectDetailWatcher = QObject::connect(&m_detailWatcher, &QFutureWatcherBase::finished, [this] {
this->onMakeDetailFinished();
});
m_detailFuture = QtConcurrent::run(this, &DrawViewDetail::makeDetailShape, shape, dvp, dvs);
m_detailWatcher.setFuture(m_detailFuture);
waitingForDetail(true);
@@ -436,7 +438,7 @@ void DrawViewDetail::postHlrTasks(void)
void DrawViewDetail::onMakeDetailFinished(void)
{
waitingForDetail(false);
QObject::disconnect(&m_detailWatcher, SIGNAL(finished()), this, SLOT(onMakeDetailFinished()));
QObject::disconnect(connectDetailWatcher);
//ancestor's buildGeometryObject will run HLR and face finding in a separate thread
geometryObject = buildGeometryObject(m_scaledShape, m_viewAxis);

View File

@@ -52,7 +52,6 @@ namespace TechDraw
class TechDrawExport DrawViewDetail : public DrawViewPart
{
PROPERTY_HEADER_WITH_OVERRIDE(Part::DrawViewDetail);
Q_OBJECT
public:
/// Constructor
@@ -102,6 +101,7 @@ protected:
TopoDS_Shape m_scaledShape;
gp_Ax2 m_viewAxis;
QMetaObject::Connection connectDetailWatcher;
QFutureWatcher<void> m_detailWatcher;
QFuture<void> m_detailFuture;
bool m_waitingForDetail;

View File

@@ -38,7 +38,6 @@ namespace TechDraw {
class TechDrawExport DrawViewDimExtent : public TechDraw::DrawViewDimension
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewDimExtent);
Q_OBJECT
public:
/// Constructor

View File

@@ -22,8 +22,8 @@
#ifndef _TechDraw_DrawViewDimension_h_
#define _TechDraw_DrawViewDimension_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <tuple>
@@ -128,8 +128,7 @@ struct arcPoints
class TechDrawExport DrawViewDimension : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewDimension);
Q_OBJECT
public:
/// Constructor
DrawViewDimension();

View File

@@ -22,8 +22,8 @@
#ifndef _DrawViewDraft_h_
#define _DrawViewDraft_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <App/DocumentObject.h>
#include <App/FeaturePython.h>
@@ -39,8 +39,7 @@ namespace TechDraw
class TechDrawExport DrawViewDraft : public TechDraw::DrawViewSymbol
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewDraft);
Q_OBJECT
public:
/// Constructor
DrawViewDraft();

View File

@@ -39,8 +39,7 @@ namespace TechDraw
class TechDrawExport DrawViewImage : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewImage);
Q_OBJECT
public:
/// Constructor
DrawViewImage();

View File

@@ -386,7 +386,9 @@ 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
QObject::connect(&m_hlrWatcher, SIGNAL(finished()), this, SLOT(onHlrFinished()));
connectHlrWatcher = QObject::connect(&m_hlrWatcher, &QFutureWatcherBase::finished, [this] {
this->onHlrFinished();}
);
m_hlrFuture = QtConcurrent::run(go, &GeometryObject::projectShape, shape, viewAxis);
m_hlrWatcher.setFuture(m_hlrFuture);
waitingForHlr(true);
@@ -402,7 +404,7 @@ void DrawViewPart::onHlrFinished(void)
bbox = geometryObject->calcBoundingBox();
waitingForHlr(false);
QObject::disconnect(&m_hlrWatcher, SIGNAL(finished()), this, SLOT(onHlrFinished()));
QObject::disconnect(connectHlrWatcher);
showProgressMessage(getNameInDocument(), "has finished finding hidden lines");
postHlrTasks(); //application level tasks that depend on HLR/GO being complete
@@ -411,7 +413,9 @@ void DrawViewPart::onHlrFinished(void)
//HLR method
if (handleFaces() && !CoarseView.getValue() && !waitingForFaces()) {
try {
QObject::connect(&m_faceWatcher, SIGNAL(finished()), this, SLOT(onFacesFinished()));
connectFaceWatcher = QObject::connect(&m_faceWatcher, &QFutureWatcherBase::finished, [this] {
this->onFacesFinished();
});
m_faceFuture = QtConcurrent::run(this, &DrawViewPart::extractFaces);
m_faceWatcher.setFuture(m_faceFuture);
waitingForFaces(true);
@@ -597,7 +601,7 @@ void DrawViewPart::onFacesFinished(void)
{
// Base::Console().Message("DVP::onFacesFinished()\n");
waitingForFaces(false);
QObject::disconnect(&m_faceWatcher, SIGNAL(finished()), this, SLOT(onFacesFinished()));
QObject::disconnect(connectFaceWatcher);
showProgressMessage(getNameInDocument(), "has finished extracting faces");
requestPaint();
}
@@ -1502,8 +1506,6 @@ int DrawViewPart::prefIsoCount()
return result;
}
#include <Mod/TechDraw/App/moc_DrawViewPart.cpp>
// Python Drawing feature ---------------------------------------------------------
namespace App {

View File

@@ -84,7 +84,6 @@ class DrawViewSection;
class TechDrawExport DrawViewPart : public DrawView, public CosmeticExtension
{
PROPERTY_HEADER_WITH_EXTENSIONS(TechDraw::DrawViewPart);
Q_OBJECT
public:
DrawViewPart();
@@ -260,8 +259,10 @@ private:
bool m_waitingForFaces;
bool m_waitingForHlr;
QMetaObject::Connection connectHlrWatcher;
QFutureWatcher<void> m_hlrWatcher;
QFuture<void> m_hlrFuture;
QMetaObject::Connection connectFaceWatcher;
QFutureWatcher<void> m_faceWatcher;
QFuture<void> m_faceFuture;

View File

@@ -285,7 +285,9 @@ void DrawViewSection::sectionExec(TopoDS_Shape& baseShape)
}
try {
QObject::connect(&m_cutWatcher, SIGNAL(finished()), this, SLOT(onSectionCutFinished()));
connectCutWatcher = QObject::connect(&m_cutWatcher, &QFutureWatcherBase::finished, [this] {
this->onSectionCutFinished();
});
m_cutFuture = QtConcurrent::run(this, &DrawViewSection::makeSectionCut, baseShape);
m_cutWatcher.setFuture(m_cutFuture);
waitingForCut(true);
@@ -419,7 +421,7 @@ void DrawViewSection::makeSectionCut(TopoDS_Shape &baseShape)
void DrawViewSection::onSectionCutFinished()
{
// Base::Console().Message("DVS::onSectionCutFinished() - %s\n", getNameInDocument());
QObject::disconnect(&m_cutWatcher, SIGNAL(finished()), this, SLOT(onSectionCutFinished()));
QObject::disconnect(connectCutWatcher);
showProgressMessage(getNameInDocument(), "has finished making section cut");
@@ -986,8 +988,6 @@ bool DrawViewSection::showSectionEdges(void)
return (hGrp->GetBool("ShowSectionEdges", true));
}
#include <Mod/TechDraw/App/moc_DrawViewSection.cpp>
// Python Drawing feature ---------------------------------------------------------
namespace App {

View File

@@ -65,7 +65,6 @@ class DashSet;
class TechDrawExport DrawViewSection : public DrawViewPart
{
PROPERTY_HEADER_WITH_OVERRIDE(Part::DrawViewSection);
Q_OBJECT
public:
DrawViewSection();
@@ -160,6 +159,7 @@ protected:
gp_Ax2 m_viewAxis;
TopoDS_Shape m_scaledShape;
QMetaObject::Connection connectCutWatcher;
QFutureWatcher<void> m_cutWatcher;
QFuture<void> m_cutFuture;
bool m_waitingForCut;

View File

@@ -38,7 +38,6 @@ namespace TechDraw
class TechDrawExport DrawViewSpreadsheet : public TechDraw::DrawViewSymbol
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewSpreadsheet);
Q_OBJECT
public:
DrawViewSpreadsheet();

View File

@@ -22,8 +22,8 @@
#ifndef _DrawViewSymbol_h_
#define _DrawViewSymbol_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
@@ -43,8 +43,7 @@ class DrawPage;
class TechDrawExport DrawViewSymbol : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawViewSymbol);
Q_OBJECT
public:
/// Constructor
DrawViewSymbol();

View File

@@ -39,7 +39,6 @@ class DrawTileWeld;
class TechDrawExport DrawWeldSymbol : public TechDraw::DrawView
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::DrawWeldSymbol);
Q_OBJECT
public:
DrawWeldSymbol();

View File

@@ -22,8 +22,8 @@
#ifndef _TechDraw_LandmarkDimension_h_
#define _TechDraw_LandmarkDimension_h_
#include <Mod/TechDraw/TechDrawGlobal.h>
#include <Mod/TechDraw/TechDrawGlobal.h>
# include <App/DocumentObject.h>
# include <App/PropertyStandard.h>
@@ -44,8 +44,7 @@ class DrawViewPart;
class TechDrawExport LandmarkDimension : public TechDraw::DrawViewDimension
{
PROPERTY_HEADER_WITH_OVERRIDE(TechDraw::LandmarkDimension);
Q_OBJECT
public:
/// Constructor
LandmarkDimension();