The method SetGroupName.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-04-06 12:36:33 +03:00
parent a8feb5d0c0
commit 9c63c4f794
3 changed files with 39 additions and 0 deletions

View File

@ -1494,3 +1494,35 @@ QDomElement VAbstractPattern::CreateGroup(quint32 id, const QString &name, const
return group;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::SetGroupName(quint32 id, const QString &name)
{
QDomElement groups = CreateGroups();
if (not groups.isNull())
{
QDomElement group = elementById(id);
if (group.isElement())
{
group.setAttribute(AttrName, name);
modified = true;
emit patternChanged(false);
}
else
{
if (groups.childNodes().isEmpty())
{
QDomNode parent = groups.parentNode();
parent.removeChild(groups);
}
qDebug("Can't get group by id = %u.", id);
return;
}
}
else
{
qDebug("Can't get tag Groups.");
return;
}
}

View File

@ -118,6 +118,7 @@ public:
QDomElement CreateGroups();
QDomElement CreateGroup(quint32 id, const QString &name, const QMap<quint32, quint32> &groupData);
void SetGroupName(quint32 id, const QString &name);
static const QString TagPattern;
static const QString TagCalculation;

View File

@ -67,6 +67,12 @@ void AddGroup::undo()
}
else
{
if (groups.childNodes().isEmpty())
{
QDomNode parent = groups.parentNode();
parent.removeChild(groups);
}
qCDebug(vUndo, "Can't get group by id = %u.", nodeId);
return;
}