From 4e6dc1ca50ae7c395fb874c91e397cd389f1b677 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Mon, 1 Jan 2024 09:01:58 -0500 Subject: [PATCH] [TD]fix positioning of secondary views --- src/Mod/TechDraw/Gui/QGIView.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Mod/TechDraw/Gui/QGIView.cpp b/src/Mod/TechDraw/Gui/QGIView.cpp index 87c1f7a0e0..d0b3d5faeb 100644 --- a/src/Mod/TechDraw/Gui/QGIView.cpp +++ b/src/Mod/TechDraw/Gui/QGIView.cpp @@ -163,6 +163,7 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value) if(change == ItemPositionChange && scene()) { newPos = value.toPointF(); //position within parent! if(m_locked){ + // ignore position change for locked items newPos.setX(pos().x()); newPos.setY(pos().y()); return newPos; @@ -170,9 +171,8 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value) TechDraw::DrawView *viewObj = getViewObject(); - // TODO find a better data structure for this - // this is just a pair isn't it? if (viewObj->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { + // restrict movements of secondary views. TechDraw::DrawProjGroupItem* dpgi = static_cast(viewObj); TechDraw::DrawProjGroup* dpg = dpgi->getPGroup(); if (dpg) { @@ -186,11 +186,11 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value) } } } - } else { - Gui::ViewProvider *vp = getViewProvider(viewObj); - if (vp && !vp->isRestoring()) { - viewObj->setPosition(Rez::appX(newPos.x()), Rez::appX(-newPos.y())); - } + } + // tell the feature that we have moved + Gui::ViewProvider *vp = getViewProvider(viewObj); + if (vp && !vp->isRestoring()) { + viewObj->setPosition(Rez::appX(newPos.x()), Rez::appX(-newPos.y())); } return newPos;