TechDraw: Fix balloon annotation unlinked after undo-redo (#22805)

* TechDraw: remove then add balloon annotation when changing the SourceView

* Use fixSceneDependencies
This commit is contained in:
theo-vt
2025-08-18 11:37:02 -04:00
committed by GitHub
parent c15cfd6615
commit 10ae4de2f2
3 changed files with 13 additions and 4 deletions

View File

@@ -82,6 +82,8 @@ public:
Base::Vector3d getOriginOffset() const;
App::PropertyLink *getOwnerProperty() override { return &SourceView; }
protected:
void onChanged(const App::Property* prop) override;
void handleChangedPropertyType(Base::XMLReader& reader, const char* TypeName,

View File

@@ -48,6 +48,7 @@
#include "QGIViewBalloon.h"
#include "TaskBalloon.h"
#include "ViewProviderBalloon.h"
#include "ViewProviderPage.h"
using namespace TechDrawGui;
using namespace TechDraw;
@@ -115,12 +116,18 @@ void ViewProviderBalloon::updateData(const App::Property* prop)
//Balloon handles X, Y updates differently that other QGIView
//call QGIViewBalloon::updateView
if (prop == &(getViewObject()->X) ||
prop == &(getViewObject()->Y) ){
prop == &(getViewObject()->Y)){
QGIView* qgiv = getQView();
if (qgiv) {
qgiv->updateView(true);
}
}
if (prop == &(getViewObject()->SourceView)) {
// Ensure the QGraphicsItems hierarchy matches the DocumentObject's
if (ViewProviderPage* vpp = getViewProviderPage()) {
vpp->fixSceneDependencies();
}
}
//Skip QGIView X, Y processing - do not call ViewProviderDrawingView
Gui::ViewProviderDocumentObject::updateData(prop);

View File

@@ -172,7 +172,6 @@ void ViewProviderDrawingView::hide()
}
}
}
QGIView* ViewProviderDrawingView::getQView()
{
TechDraw::DrawView* dv = getViewObject();
@@ -190,8 +189,9 @@ QGIView* ViewProviderDrawingView::getQView()
return nullptr;
}
if (vpp->getQGSPage()) {
return dynamic_cast<QGIView *>(vpp->getQGSPage()->findQViewForDocObj(getViewObject()));
QGSPage* page = vpp->getQGSPage();
if (page) {
return dynamic_cast<QGIView *>(page->findQViewForDocObj(getViewObject()));
}
return nullptr;