issue 826 pattern modified when group modified

--HG--
branch : feature
This commit is contained in:
Ronan Le Tiec 2018-03-30 11:02:10 +02:00
parent 5b181cc3b8
commit 5fba6b797b
2 changed files with 13 additions and 2 deletions

View File

@ -2486,6 +2486,8 @@ void VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, quint32
item.setAttribute(AttrObject, objectId); item.setAttribute(AttrObject, objectId);
group.appendChild(item); group.appendChild(item);
modified = true;
emit patternChanged(false);
emit UpdateGroups(); emit UpdateGroups();
} }
else else
@ -2526,6 +2528,9 @@ void VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, qui
if(toolIdIterate == toolId && objectIdIterate == objectId) if(toolIdIterate == toolId && objectIdIterate == objectId)
{ {
group.removeChild(itemNode); group.removeChild(itemNode);
modified = true;
emit patternChanged(false);
emit UpdateGroups(); emit UpdateGroups();
break; break;
} }

View File

@ -149,8 +149,14 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
GOType itemType = GOType::Unknown; GOType itemType = GOType::Unknown;
if(itemId != NULL_ID) if(itemId != NULL_ID)
{ {
const auto obj = data.GetGObject(itemId); try
itemType = obj->getType(); {
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."); qCDebug(vTool, "Creating tool context menu.");