From cc1b5736d9c9ee429e1f17ac7fcfdf899e1ffb8d Mon Sep 17 00:00:00 2001 From: wandererfan Date: Tue, 3 Dec 2019 13:08:06 -0500 Subject: [PATCH 1/5] [TD]fix jumping Rich Text Annotation --- src/Mod/TechDraw/App/DrawRichAnno.cpp | 3 +- src/Mod/TechDraw/App/DrawRichAnno.h | 2 - src/Mod/TechDraw/Gui/CommandAnnotate.cpp | 3 +- src/Mod/TechDraw/Gui/QGIRichAnno.cpp | 130 ++++++++++------------- src/Mod/TechDraw/Gui/QGIRichAnno.h | 17 ++- src/Mod/TechDraw/Gui/TaskRichAnno.cpp | 10 +- 6 files changed, 77 insertions(+), 88 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawRichAnno.cpp b/src/Mod/TechDraw/App/DrawRichAnno.cpp index 377031572b..95f3cde049 100644 --- a/src/Mod/TechDraw/App/DrawRichAnno.cpp +++ b/src/Mod/TechDraw/App/DrawRichAnno.cpp @@ -56,7 +56,6 @@ DrawRichAnno::DrawRichAnno(void) Scale.setStatus(App::Property::Hidden,true); ScaleType.setStatus(App::Property::Hidden,true); - } DrawRichAnno::~DrawRichAnno() @@ -87,7 +86,7 @@ short DrawRichAnno::mustExecute() const App::DocumentObjectExecReturn *DrawRichAnno::execute(void) { -// Base::Console().Message("DRA::execute()\n"); +// Base::Console().Message("DRA::execute() - @ (%.3f, %.3f)\n", X.getValue(), Y.getValue()); if (!keepUpdated()) { return App::DocumentObject::StdReturn; } diff --git a/src/Mod/TechDraw/App/DrawRichAnno.h b/src/Mod/TechDraw/App/DrawRichAnno.h index 7e59902f58..179797296c 100644 --- a/src/Mod/TechDraw/App/DrawRichAnno.h +++ b/src/Mod/TechDraw/App/DrawRichAnno.h @@ -42,10 +42,8 @@ public: App::PropertyLink AnnoParent; App::PropertyString AnnoText; -// App::PropertyVector TextPosition; App::PropertyBool ShowFrame; App::PropertyFloat MaxWidth; - App::PropertyVector AttachPoint; virtual short mustExecute() const; virtual App::DocumentObjectExecReturn *execute(void); diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index 895a9cc0a7..217c7b2242 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -192,8 +192,7 @@ void CmdTechDrawRichTextAnnotation::activated(int iMsg) bool CmdTechDrawRichTextAnnotation::isActive(void) { bool havePage = DrawGuiUtil::needPage(this); - bool haveView = DrawGuiUtil::needView(this, false); - return (havePage && haveView); + return havePage; } diff --git a/src/Mod/TechDraw/Gui/QGIRichAnno.cpp b/src/Mod/TechDraw/Gui/QGIRichAnno.cpp index 47e31314c0..7cd18ae006 100644 --- a/src/Mod/TechDraw/Gui/QGIRichAnno.cpp +++ b/src/Mod/TechDraw/Gui/QGIRichAnno.cpp @@ -66,6 +66,8 @@ #include "QGEPath.h" #include "QGMText.h" #include "QGIView.h" +#include "QGCustomText.h" +#include "QGCustomRect.h" #include "QGIRichAnno.h" @@ -79,38 +81,30 @@ QGIRichAnno::QGIRichAnno(QGraphicsItem* myParent, { setHandlesChildEvents(false); setAcceptHoverEvents(false); - setFlag(QGraphicsItem::ItemIsSelectable, false); //we actually select & drag m_text - setFlag(QGraphicsItem::ItemIsMovable, false); + setFlag(QGraphicsItem::ItemIsSelectable, true); + setFlag(QGraphicsItem::ItemIsMovable, true); setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true); setFlag(QGraphicsItem::ItemSendsGeometryChanges,true); if (myParent != nullptr) { setParentItem(myParent); } + setViewFeature(anno); - m_text = new QGMText(); + m_text = new QGCustomText(); m_text->setTextInteractionFlags(Qt::NoTextInteraction); addToGroup(m_text); m_text->setZValue(ZVALUE::DIMENSION); + m_text->centerAt(0.0, 0.0); + m_rect = new QGCustomRect(); + addToGroup(m_rect); + m_rect->setZValue(ZVALUE::DIMENSION - 1); + m_rect->centerAt(0.0, 0.0); + setZValue(ZVALUE::DIMENSION); - QObject::connect( - m_text, SIGNAL(dragging()), - this , SLOT (textDragging()) - ); - QObject::connect( - m_text, SIGNAL(dragFinished()), - this , SLOT (textDragFinished()) - ); - QObject::connect( - m_text, SIGNAL(selected(bool)), - this , SLOT (select(bool))); - - QObject::connect( - m_text, SIGNAL(hover(bool)), - this , SLOT (hover(bool))); } QVariant QGIRichAnno::itemChange(GraphicsItemChange change, const QVariant &value) @@ -123,52 +117,17 @@ QVariant QGIRichAnno::itemChange(GraphicsItemChange change, const QVariant &valu return QGIView::itemChange(change, value); } -void QGIRichAnno::textDragging(void) -{ -// Base::Console().Message("QGIRA::textDragging()\n"); - //this is the long way around. can we do it without crossing the App/Gui boundary? - //just update graphics until drag finished. -// auto lead( dynamic_cast(getFeature()) ); +//void QGIRichAnno::select(bool state) +//{ +// setSelected(state); +// draw(); +//} -// if( lead == nullptr ) { -// return; -// } - -// double x = Rez::appX(m_text->x()), -// y = Rez::appX(m_text->y()); -// Base::Vector3d tPos(x,-y,0.0); -// Gui::Command::openCommand("Drag Text"); -// lead->TextPosition.setValue(tPos); -// Gui::Command::commitCommand(); -// draw(); -} - -void QGIRichAnno::textDragFinished(void) -{ -// Base::Console().Message("QGIRA::textDragFinished()\n"); - auto anno( dynamic_cast(getFeature()) ); - - if( anno == nullptr ) { - return; - } - - double x = Rez::appX(m_text->x()) / getScale(); - double y = - Rez::appX(m_text->y()) / getScale(); - anno->X.setValue(x); - anno->Y.setValue(y); -} - -void QGIRichAnno::select(bool state) -{ - setSelected(state); - draw(); -} - -void QGIRichAnno::hover(bool state) -{ - m_hasHover = state; - draw(); -} +//void QGIRichAnno::hover(bool state) +//{ +// m_hasHover = state; +// draw(); +//} void QGIRichAnno::updateView(bool update) { @@ -184,6 +143,13 @@ void QGIRichAnno::updateView(bool update) if ( vp == nullptr ) { return; } + if (annoFeat->X.isTouched() || + annoFeat->Y.isTouched()) { + float x = Rez::guiX(annoFeat->X.getValue()); + float y = Rez::guiX(annoFeat->Y.getValue()); + m_text->centerAt(x, -y); + m_rect->centerAt(x, -y); + } draw(); } @@ -197,23 +163,25 @@ void QGIRichAnno::drawBorder() void QGIRichAnno::draw() { -// Base::Console().Log("QGITL::draw() - %s\n",getFeature()->getNameInDocument()); +// Base::Console().Log("QGIRA::draw() - %s - parent: %X\n",getFeature()->getNameInDocument(), parentItem()); if (!isVisible()) { - Base::Console().Log("QGITL::draw - not visible\n"); +// Base::Console().Message("QGIRA::draw - not visible\n"); return; } TechDraw::DrawRichAnno* annoFeat = getFeature(); if((!annoFeat) ) { - Base::Console().Log("QGITL::draw - no feature\n"); +// Base::Console().Message("QGIRA::draw - no feature\n"); return; } auto vp = static_cast(getViewProvider(getFeature())); if ( vp == nullptr ) { - Base::Console().Log("QGITL::draw - no viewprovider\n"); +// Base::Console().Message("QGIRA::draw - no viewprovider\n"); return; } +// double appX = Rez::guiX(annoFeat->X.getValue()); +// double appY = Rez::guiX(annoFeat->Y.getValue()); QGIView::draw(); @@ -257,14 +225,20 @@ void QGIRichAnno::setTextItem() m_text->setHtml(outHtml); m_text->setTextWidth(Rez::guiX(annoFeat->MaxWidth.getValue())); - m_text->showBox(annoFeat->ShowFrame.getValue()); - double scale = getScale(); - double x = Rez::guiX(annoFeat->X.getValue()); - double y = Rez::guiX(annoFeat->Y.getValue()); - Base::Vector3d textPos(x,y,0.0); - QPointF tPos(textPos.x * scale,- textPos.y * scale); - m_text->setPos(tPos); +// m_text->showBox(annoFeat->ShowFrame.getValue()); + if (annoFeat->ShowFrame.getValue()) { + QRectF r = m_text->boundingRect().adjusted(1,1,-1,-1); + m_rect->setPen(rectPen()); + m_rect->setBrush(Qt::NoBrush); + m_rect->setRect(r); + m_rect->show(); + } else { + m_rect->hide(); + } + + m_text->centerAt(0.0, 0.0); + m_rect->centerAt(0.0, 0.0); } //void QGIRichAnno::drawBorder() @@ -301,4 +275,12 @@ void QGIRichAnno::paint ( QPainter * painter, const QStyleOptionGraphicsItem * o QGIView::paint (painter, &myOption, widget); } +QPen QGIRichAnno::rectPen() const +{ + QPen pen(Qt::SolidLine); + pen.setWidthF(1.0); + return pen; +} + + #include diff --git a/src/Mod/TechDraw/Gui/QGIRichAnno.h b/src/Mod/TechDraw/Gui/QGIRichAnno.h index 38991fc9c8..fc2b0f20ba 100644 --- a/src/Mod/TechDraw/Gui/QGIRichAnno.h +++ b/src/Mod/TechDraw/Gui/QGIRichAnno.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "QGILeaderLine.h" @@ -47,6 +48,8 @@ class QGIPrimPath; class QGIArrow; class QGEPath; class QGMText; +class QGCustomText; +class QGCustomRect; //******************************************************************* @@ -75,12 +78,14 @@ public: void setTextItem(void); virtual TechDraw::DrawRichAnno* getFeature(void); + QPen rectPen() const; + public Q_SLOTS: - void textDragging(void); - void textDragFinished(void); - void hover(bool state); - void select(bool state); +/* void textDragging(void);*/ +/* void textDragFinished(void);*/ +/* void hover(bool state);*/ +/* void select(bool state);*/ protected: virtual void draw() override; @@ -88,8 +93,10 @@ protected: const QVariant &value ) override; protected: - QGMText* m_text; +/* QGMText* m_text;*/ + QGCustomText* m_text; bool m_hasHover; + QGCustomRect* m_rect; }; diff --git a/src/Mod/TechDraw/Gui/TaskRichAnno.cpp b/src/Mod/TechDraw/Gui/TaskRichAnno.cpp index 93f8e700e6..602abc7515 100644 --- a/src/Mod/TechDraw/Gui/TaskRichAnno.cpp +++ b/src/Mod/TechDraw/Gui/TaskRichAnno.cpp @@ -145,6 +145,7 @@ TaskRichAnno::TaskRichAnno(TechDraw::DrawView* baseFeat, return; } + ui->setupUi(this); m_title = QObject::tr("Rich text creator"); @@ -278,7 +279,7 @@ void TaskRichAnno::createAnnoFeature() std::string PageName = m_basePage->getNameInDocument(); - Gui::Command::openCommand("Create Leader"); + Gui::Command::openCommand("Create Anno"); Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')", annoType.c_str(),annoName.c_str()); Command::doCommand(Command::Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)", @@ -309,7 +310,7 @@ void TaskRichAnno::createAnnoFeature() void TaskRichAnno::updateAnnoFeature() { // Base::Console().Message("TRA::updateAnnoFeature()\n"); - Gui::Command::openCommand("Edit Leader"); + Gui::Command::openCommand("Edit Anno"); commonFeatureUpdate(); Gui::Command::commitCommand(); @@ -375,16 +376,19 @@ QPointF TaskRichAnno::calcTextStartPos(double scale) TechDraw::DrawLeaderLine* dll = dynamic_cast(m_baseFeat); points = dll->WayPoints.getValues(); } else { - Base::Console().Log("TRA::calcTextPos - m_baseFeat is not Leader\n"); +// Base::Console().Message("TRA::calcTextPos - m_baseFeat is not Leader\n"); QPointF result(0.0,0.0); return result; } } else { +// Base::Console().Message("TRA::calcStartPos - no m_baseFeat\n"); if (m_basePage != nullptr) { double w = Rez::guiX(m_basePage->getPageWidth() / 2.0); double h = Rez::guiX(m_basePage->getPageHeight() / 2.0); QPointF result(w,h); return result; + } else { + Base::Console().Message("TRA::calcStartPos - no m_basePage\n"); } } From 8b3d33b349e7824dd3983b5967aab0bd8e7067c0 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Tue, 3 Dec 2019 22:27:37 -0500 Subject: [PATCH 2/5] [TD]Annotation icon to standards - by @bitacovir --- .../icons/actions/techdraw-annotation.svg | 1209 +++++++---------- 1 file changed, 526 insertions(+), 683 deletions(-) mode change 100755 => 100644 src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-annotation.svg diff --git a/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-annotation.svg b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-annotation.svg old mode 100755 new mode 100644 index 66887bea9c..263d331c20 --- a/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-annotation.svg +++ b/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-annotation.svg @@ -12,655 +12,308 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="64px" height="64px" - id="svg2985" - version="1.1" - inkscape:version="0.92.4 (unknown)" - sodipodi:docname="techdraw-annotation.svg"> + id="svg2766" + sodipodi:version="0.32" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + sodipodi:docname="Draft_Scale.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + version="1.1"> + Techdraw-annotation + id="defs2768"> + inkscape:collect="always" + id="linearGradient3856"> + id="stop3858" /> + id="stop3860" /> + id="linearGradient3787"> + style="stop-color:#0619c0;stop-opacity:1;" /> + style="stop-color:#379cfb;stop-opacity:1;" /> + + + + + + + + + + - - - + gradientTransform="translate(81.960023,0.99999951)" + inkscape:collect="always" + xlink:href="#linearGradient3856" + id="linearGradient3862-9" + x1="613.25824" + y1="135.1946" + x2="595.35895" + y2="68.194603" + gradientUnits="userSpaceOnUse" /> + xlink:href="#linearGradient3856" + id="linearGradient3862-3" + x1="613.25824" + y1="135.1946" + x2="595.35895" + y2="68.194603" + gradientUnits="userSpaceOnUse" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + xlink:href="#linearGradient3856" + id="linearGradient1176" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(5.0430738e-6)" + x1="613.25824" + y1="135.1946" + x2="607.60583" + y2="119.1946" /> + + + + + + + + + + id="stop3794" /> + id="stop3796" /> + + + + + + + + + + inkscape:window-maximized="1"> - + snapvisiblegridlinesonly="true" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id="metadata5370"> image/svg+xml - + Techdraw-annotation + + 2019-01-14 - [WandererFan] + [bitacovir] - techdraw-annotation - 2016-01-14 - http://www.freecadweb.org/wiki/index.php?title=Artwork - - - FreeCAD - - - FreeCAD/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-annotation.svg FreeCAD LGPL2+ - https://www.gnu.org/copyleft/lesser.html + + + FreeCAD + + + + - [agryson] Alexander Gryson + + + + letter + dotted line + + + + + + + + + + + - - - - Abc - From ee418c1281e6d89ab3994346719d68b1e23479c5 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Tue, 26 Nov 2019 08:28:06 +0800 Subject: [PATCH 3/5] Draft: fix Layer for Python2 --- src/Mod/Draft/DraftLayer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/DraftLayer.py b/src/Mod/Draft/DraftLayer.py index 2efbf83d1a..572e42c829 100644 --- a/src/Mod/Draft/DraftLayer.py +++ b/src/Mod/Draft/DraftLayer.py @@ -139,11 +139,11 @@ class ViewProviderLayer: vobj.OverrideChildren = True c = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned("DefaultShapeLineColor",255) - vobj.LineColor = (((c>>24)&0xFF)/255,((c>>16)&0xFF)/255,((c>>8)&0xFF)/255) + vobj.LineColor = (((c>>24)&0xFF)/255.0,((c>>16)&0xFF)/255.0,((c>>8)&0xFF)/255.0) w = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetInt("DefaultShapeLineWidth",2) vobj.LineWidth = w c = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View").GetUnsigned("DefaultShapeColor",4294967295) - vobj.ShapeColor = (((c>>24)&0xFF)/255,((c>>16)&0xFF)/255,((c>>8)&0xFF)/255) + vobj.ShapeColor = (((c>>24)&0xFF)/255.0,((c>>16)&0xFF)/255.0,((c>>8)&0xFF)/255.0) vobj.DrawStyle = "Solid" vobj.Proxy = self From bad5a31327336b49a91a9620221759dedfa65fce Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Tue, 26 Nov 2019 08:28:30 +0800 Subject: [PATCH 4/5] Draft: signal icon change in Layer --- src/Mod/Draft/DraftLayer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mod/Draft/DraftLayer.py b/src/Mod/Draft/DraftLayer.py index 572e42c829..3252988101 100644 --- a/src/Mod/Draft/DraftLayer.py +++ b/src/Mod/Draft/DraftLayer.py @@ -225,6 +225,7 @@ class ViewProviderLayer: b.open(QtCore.QIODevice.WriteOnly) im.save(b,"XPM") self.icondata = ba.data().decode("latin1") + vobj.signalChangeIcon() def canDragObject(self,obj): return True From ed30896648f0009086454ee91c56f529b35fbc3e Mon Sep 17 00:00:00 2001 From: WandererFan Date: Mon, 25 Nov 2019 20:42:54 -0500 Subject: [PATCH 5/5] [TD]Prevent crash when base view deleted - happened during creation of DVSection --- src/Mod/TechDraw/Gui/TaskSectionView.cpp | 54 +++++++++++++++++++----- src/Mod/TechDraw/Gui/TaskSectionView.h | 5 ++- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp index cd3608968f..37f6647ab8 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.cpp +++ b/src/Mod/TechDraw/Gui/TaskSectionView.cpp @@ -87,6 +87,8 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base) : Base::Console().Error((msg + "\n").c_str()); return; } + m_saveBaseName = m_base->getNameInDocument(); + m_savePageName = m_base->findParentPage()->getNameInDocument(); ui->setupUi(this); @@ -129,6 +131,9 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewSection* section) : throw Base::RuntimeError("TaskSectionView - BaseView not found"); } + m_saveBaseName = m_base->getNameInDocument(); + m_savePageName = m_base->findParentPage()->getNameInDocument(); + ui->setupUi(this); connect(ui->pbUp, SIGNAL(clicked(bool)), @@ -269,9 +274,15 @@ void TaskSectionView::onApplyClicked(bool b) apply(); } -void TaskSectionView::apply(void) +bool TaskSectionView::apply(void) { // Base::Console().Message("TSV::apply() - m_dirName: %s\n", m_dirName.c_str()); + App::Document* doc = m_section->getDocument(); + App::DocumentObject* baseObj = doc->getObject(m_saveBaseName.c_str()); + TechDraw::DrawViewPart* dvp = dynamic_cast(baseObj); + if (dvp == nullptr) { + return false; + } if (m_dirName.empty()) { std::string msg = Base::Tools::toStdString(tr("TSV::apply - No section direction picked yet")); Base::Console().Error((msg + "\n").c_str()); @@ -279,6 +290,7 @@ void TaskSectionView::apply(void) checkAll(false); applyQuick(m_dirName); } + return true; } void TaskSectionView::checkAll(bool b) @@ -295,12 +307,15 @@ void TaskSectionView::applyQuick(std::string dir) // Base::Console().Message("TSV::applyQuick(%s)\n", dir.c_str()); m_dirName = dir; Gui::Command::openCommand("Apply Quick"); + m_dirName = dir; if (m_section == nullptr) { m_section = createSectionView(); } if (m_section != nullptr) { updateSectionView(); - m_section->recomputeFeature(); + m_section->recomputeFeature(); + } + if (m_base != nullptr) { m_base->requestPaint(); } } @@ -385,6 +400,7 @@ void TaskSectionView::updateSectionView(void) } } + //****************************************************************************** bool TaskSectionView::accept() @@ -394,10 +410,12 @@ bool TaskSectionView::accept() if (m_section == nullptr) { apply(); } + Gui::Command::updateActive(); + Gui::Command::commitCommand(); } else { Gui::Command::openCommand("Edit SectionView"); try { - apply(); + updateSectionView(); } catch (...) { Base::Console().Error("TSV::accept - failed to update section\n"); @@ -409,9 +427,12 @@ bool TaskSectionView::accept() Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()"); if (m_section != nullptr) { m_section->requestPaint(); - } - if (m_base != nullptr) { - m_base->requestPaint(); + App::Document* doc = m_section->getDocument(); + App::DocumentObject* baseObj = doc->getObject(m_saveBaseName.c_str()); + TechDraw::DrawViewPart* dvp = dynamic_cast(baseObj); + if (dvp != nullptr) { + dvp->requestPaint(); + } } return true; } @@ -419,21 +440,27 @@ bool TaskSectionView::accept() bool TaskSectionView::reject() { // Base::Console().Message("TSV::reject()\n"); - std::string PageName = m_base->findParentPage()->getNameInDocument(); if (m_section != nullptr) { if (m_createMode) { std::string SectionName = m_section->getNameInDocument(); Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.removeView(App.activeDocument().%s)", - PageName.c_str(),SectionName.c_str()); + m_savePageName.c_str(),SectionName.c_str()); Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().removeObject('%s')", SectionName.c_str()); } else { restoreSectionState(); //check undo stack? - m_section->requestPaint(); - m_base->requestPaint(); + if (m_section != nullptr) { + m_section->requestPaint(); + App::Document* doc = m_section->getDocument(); + App::DocumentObject* baseObj = doc->getObject(m_saveBaseName.c_str()); + TechDraw::DrawViewPart* dvp = dynamic_cast(baseObj); + if (dvp != nullptr) { + dvp->requestPaint(); + } + } } } @@ -490,6 +517,13 @@ bool TaskDlgSectionView::accept() return true; } +//bool TaskDlgSectionView::apply() +//{ +// Base::Console().Message("TDSV::apply()\n"); +// widget->apply(); +// return true; +//} + bool TaskDlgSectionView::reject() { widget->reject(); diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.h b/src/Mod/TechDraw/Gui/TaskSectionView.h index 03b6ed3b95..b66fa0a66c 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.h +++ b/src/Mod/TechDraw/Gui/TaskSectionView.h @@ -64,7 +64,7 @@ protected: void saveSectionState(); void restoreSectionState(); - void apply(void); + bool apply(void); void applyQuick(std::string dir); void applyAligned(void); @@ -97,6 +97,9 @@ private: bool m_createMode; bool m_saved; + std::string m_saveBaseName; + std::string m_savePageName; + }; class TaskDlgSectionView : public Gui::TaskView::TaskDialog