mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
User can export / import the configuration of the texts and texts group of an element.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5195 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -75,6 +75,20 @@ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name
|
||||
setText(QObject::tr("Ajouter un groupe de textes d'élément"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AddTextsGroupCommand::AddTextsGroupCommand
|
||||
* @param element : The element to add a new group
|
||||
* @param dom_element : the first time the group is created, we call the function fromXml of the group, and give @dom_element has argument.
|
||||
* @param parent : parent undo
|
||||
*/
|
||||
AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QDomElement dom_element, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_element(element),
|
||||
m_dom_element(dom_element)
|
||||
{
|
||||
setText(QObject::tr("Ajouter un groupe de textes d'élément"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AddTextsGroupCommand::~AddTextsGroupCommand
|
||||
* Destructor
|
||||
@@ -95,10 +109,22 @@ void AddTextsGroupCommand::redo()
|
||||
if(m_first_undo)
|
||||
{
|
||||
m_group = m_element.data()->addTextGroup(m_name);
|
||||
if(!m_dom_element.isNull())
|
||||
{
|
||||
m_group.data()->fromXml(m_dom_element);
|
||||
//We get the list of texts (if any) because when undo is called, all child text will be removed
|
||||
//from the group, and reparented to m_elemeny.
|
||||
//Then the next time redo is called, the texts will be added to the group
|
||||
m_deti_list = m_group.data()->texts();
|
||||
}
|
||||
m_first_undo = false;
|
||||
}
|
||||
else if(m_group)
|
||||
{
|
||||
m_element.data()->addTextGroup(m_group.data());
|
||||
for(DynamicElementTextItem *deti : m_deti_list)
|
||||
m_element.data()->addTextToGroup(deti, m_group.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user