From e48fee5acc8efa99c500e3c9dd9a5dc18593dacd Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 2 Mar 2025 09:03:56 -0500 Subject: [PATCH] [TD]Property types and spinboxes for Detail --- src/Mod/TechDraw/App/DrawViewDetail.cpp | 31 ++- src/Mod/TechDraw/App/DrawViewDetail.h | 6 +- src/Mod/TechDraw/Gui/TaskDetail.ui | 260 +++++++++++++----------- 3 files changed, 171 insertions(+), 126 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewDetail.cpp b/src/Mod/TechDraw/App/DrawViewDetail.cpp index 6a31f6efd9..9473c7fbd6 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.cpp +++ b/src/Mod/TechDraw/App/DrawViewDetail.cpp @@ -139,7 +139,6 @@ void DrawViewDetail::onChanged(const App::Property* prop) App::DocumentObjectExecReturn* DrawViewDetail::execute() { - // Base::Console().Message("DVD::execute() - %s\n", getNameInDocument()); if (!keepUpdated()) { return DrawView::execute(); } @@ -254,6 +253,7 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart* TopoDS_Face extrusionFace; Base::Vector3d extrudeVec = dirDetail * extrudeLength; + gp_Vec extrudeDir(extrudeVec.x, extrudeVec.y, extrudeVec.z); TopoDS_Shape tool; if (Preferences::mattingStyle()) { @@ -381,7 +381,6 @@ void DrawViewDetail::makeDetailShape(const TopoDS_Shape& shape3d, DrawViewPart* void DrawViewDetail::postHlrTasks(void) { - // Base::Console().Message("DVD::postHlrTasks()\n"); DrawViewPart::postHlrTasks(); geometryObject->pruneVertexGeom(Base::Vector3d(0.0, 0.0, 0.0), @@ -465,9 +464,35 @@ bool DrawViewDetail::debugDetail() const return Preferences::getPreferenceGroup("debug")->GetBool("debugDetail", false); } +void DrawViewDetail::handleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, App::Property * prop) +{ + if (prop == &AnchorPoint) { + // AnchorPoint was PropertyVector but is now PropertyPosition + App::PropertyVector tmp; + if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { + tmp.setContainer(this); + tmp.Restore(reader); + auto tmpValue = tmp.getValue(); + AnchorPoint.setValue(tmpValue); + } + return; + } + + if (prop == &Radius) { + // Radius was PropertyFloat but is now PropertyLength + App::PropertyLength tmp; + if (strcmp(tmp.getTypeId().getName(), TypeName)==0) { + tmp.setContainer(this); + tmp.Restore(reader); + auto tmpValue = tmp.getValue(); + Radius.setValue(tmpValue); + } + return; + } +} + void DrawViewDetail::unsetupObject() { - // Base::Console().Message("DVD::unsetupObject()\n"); App::DocumentObject* baseObj = BaseView.getValue(); DrawView* base = dynamic_cast(baseObj); if (base) { diff --git a/src/Mod/TechDraw/App/DrawViewDetail.h b/src/Mod/TechDraw/App/DrawViewDetail.h index 70375b6f56..8c79e85344 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.h +++ b/src/Mod/TechDraw/App/DrawViewDetail.h @@ -57,8 +57,8 @@ public: ~DrawViewDetail() override; App::PropertyLink BaseView; - App::PropertyVector AnchorPoint; - App::PropertyFloat Radius; + App::PropertyPosition AnchorPoint; + App::PropertyLength Radius; App::PropertyString Reference; App::PropertyBool ShowMatting; @@ -71,6 +71,8 @@ public: return "TechDrawGui::ViewProviderViewPart"; } void unsetupObject() override; + void handleChangedPropertyType( + Base::XMLReader &reader, const char * TypeName, App::Property * prop) override; void detailExec(TopoDS_Shape& s, diff --git a/src/Mod/TechDraw/Gui/TaskDetail.ui b/src/Mod/TechDraw/Gui/TaskDetail.ui index 9d506516c0..5877379998 100644 --- a/src/Mod/TechDraw/Gui/TaskDetail.ui +++ b/src/Mod/TechDraw/Gui/TaskDetail.ui @@ -6,10 +6,16 @@ 0 0 - 300 - 264 + 497 + 367 + + + 0 + 0 + + Detail Anchor @@ -107,95 +113,7 @@ - - - - - X - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - x position of detail highlight within view - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - 0.000000000000000 - - - - - - - Y - - - - - - - y position of detail highlight within view - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - - - - - Radius - - - - - - - size of detail view - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - false - - - - - - 10.000000000000000 - - - + @@ -203,35 +121,13 @@ - - + + - Page: scale factor of page is used -Automatic: if the detail view is larger than the page, - it will be scaled down to fit into the page -Custom: custom scale factor is used + reference label - - - Page - - - - - Automatic - - - - - Custom - - - - - - - - Scale Factor + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -260,6 +156,60 @@ Custom: custom scale factor is used + + + + + 0 + 0 + + + + y position of detail highlight within view + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + + + + + Scale Factor + + + + + + + + 0 + 0 + + + + size of detail view + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + + + + 10.000000000000000 + + + @@ -267,16 +217,84 @@ Custom: custom scale factor is used - - + + + + + 0 + 0 + + - reference label + x position of detail highlight within view Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Radius + + + + + + + X + + + + + + + Page: scale factor of page is used +Automatic: if the detail view is larger than the page, + it will be scaled down to fit into the page +Custom: custom scale factor is used + + + + Page + + + + + Automatic + + + + + Custom + + + + + + + + Y + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + +