From aae05d172b9e765760e3f4d42c8a7dd06a517422 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 17 Apr 2013 15:24:57 +0200 Subject: [PATCH] fixed erasing problems --- src/adaptors/UBSvgSubsetAdaptor.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 62e6cc18..c1bbfaaa 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -392,6 +392,7 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() mFileVersion = 40100; // default to 4.1.0 UBGraphicsStrokesGroup* strokesGroup = 0; + UBGraphicsStroke* currentStroke = 0; while (!mXmlReader.atEnd()) { @@ -559,11 +560,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() { polygonItem->setUuid(uuidFromSvg); - if(strokesGroup){ - polygonItem->setTransform(strokesGroup->transform()); - strokesGroup->addToGroup(polygonItem); - polygonItem->setStrokesGroup(strokesGroup); - } polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); @@ -571,10 +567,16 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() if(!mStrokesList.contains(parentId)){ group = new UBGraphicsStrokesGroup(); mStrokesList.insert(parentId,group); + currentStroke = new UBGraphicsStroke(); } else group = mStrokesList.value(parentId); + polygonItem->setTransform(group->transform()); + group->addToGroup(polygonItem); + polygonItem->setStrokesGroup(group); + polygonItem->setStroke(currentStroke); + polygonItem->show(); group->addToGroup(polygonItem); @@ -589,23 +591,22 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() foreach(UBGraphicsPolygonItem* polygonItem, polygonItems) { - - if(strokesGroup){ - polygonItem->setTransform(strokesGroup->transform()); - strokesGroup->addToGroup(polygonItem); - polygonItem->setStrokesGroup(strokesGroup); - } - polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); UBGraphicsStrokesGroup* group; if(!mStrokesList.contains(parentId)){ group = new UBGraphicsStrokesGroup(); mStrokesList.insert(parentId,group); + currentStroke = new UBGraphicsStroke(); } else group = mStrokesList.value(parentId); + polygonItem->setTransform(group->transform()); + group->addToGroup(polygonItem); + polygonItem->setStrokesGroup(group); + polygonItem->setStroke(currentStroke); + polygonItem->show(); group->addToGroup(polygonItem); }