From 5fba6b797b03f2d092605d584ed5cdd71137a614 Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Fri, 30 Mar 2018 11:02:10 +0200 Subject: [PATCH] issue 826 pattern modified when group modified --HG-- branch : feature --- src/libs/ifc/xml/vabstractpattern.cpp | 5 +++++ src/libs/vtools/tools/drawTools/vdrawtool.h | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 93528ac86..98c0de503 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -2486,6 +2486,8 @@ void VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, quint32 item.setAttribute(AttrObject, objectId); group.appendChild(item); + modified = true; + emit patternChanged(false); emit UpdateGroups(); } else @@ -2526,6 +2528,9 @@ void VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui if(toolIdIterate == toolId && objectIdIterate == objectId) { group.removeChild(itemNode); + + modified = true; + emit patternChanged(false); emit UpdateGroups(); break; } diff --git a/src/libs/vtools/tools/drawTools/vdrawtool.h b/src/libs/vtools/tools/drawTools/vdrawtool.h index ef611c385..59c94d768 100644 --- a/src/libs/vtools/tools/drawTools/vdrawtool.h +++ b/src/libs/vtools/tools/drawTools/vdrawtool.h @@ -149,8 +149,14 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI GOType itemType = GOType::Unknown; if(itemId != NULL_ID) { - const auto obj = data.GetGObject(itemId); - itemType = obj->getType(); + try + { + itemType = data.GetGObject(itemId)->getType(); + } + catch (const VExceptionBadId &e) + { // Possible case. Parent was deleted, but the node object is still here. + qWarning() << qUtf8Printable(e.ErrorMessage()); + } } qCDebug(vTool, "Creating tool context menu.");