For avoiding errors in future better seek the first tag draw and insert before

it.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-02-20 10:05:18 +02:00
parent d0bdd46d77
commit c3db8bab68

View File

@ -62,17 +62,17 @@ void DeletePatternPiece::undo()
rootElement.insertAfter(patternPiece, previousPP);
}
else
{ // first in the list, add after tag increments
const QDomNodeList list = rootElement.elementsByTagName(VAbstractPattern::TagIncrements);
QDomElement increment;
{ // first in the list, add before tag draw
const QDomNodeList list = rootElement.elementsByTagName(VAbstractPattern::TagDraw);
QDomElement draw;
if (not list.isEmpty())
{
increment = list.at(0).toElement();
draw = list.at(0).toElement();
}
Q_ASSERT_X(not increment.isNull(), Q_FUNC_INFO, "Couldn't' find tag Increments");
rootElement.insertAfter(patternPiece, increment);
Q_ASSERT_X(not draw.isNull(), Q_FUNC_INFO, "Couldn't' find tag draw");
rootElement.insertBefore(patternPiece, draw);
}
emit NeedFullParsing();