mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Element editor : Now every "old text" are converted to the new dynamic text, when open an element in the element editor
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5263 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -971,7 +971,6 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document)
|
||||
continue;
|
||||
CustomElementPart *cep = nullptr;
|
||||
PartDynamicTextField *pdtf = nullptr;
|
||||
bool convertibleTextField = false;
|
||||
|
||||
if (qde.tagName() == "line") cep = new PartLine (m_element_editor);
|
||||
else if (qde.tagName() == "rect") cep = new PartRectangle(m_element_editor);
|
||||
@@ -983,14 +982,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document)
|
||||
else if (qde.tagName() == "arc") cep = new PartArc (m_element_editor);
|
||||
else if (qde.tagName() == "dynamic_text") cep = new PartDynamicTextField (m_element_editor);
|
||||
//For the input (aka the old text field) we try to convert it to the new partDynamicTextField
|
||||
else if (qde.tagName() == "input")
|
||||
{
|
||||
convertibleTextField = PartDynamicTextField::canImportFromTextField(qde);
|
||||
if(convertibleTextField)
|
||||
cep = pdtf = new PartDynamicTextField(m_element_editor);
|
||||
else
|
||||
cep = new PartTextField(m_element_editor);
|
||||
}
|
||||
else if (qde.tagName() == "input") cep = pdtf = new PartDynamicTextField(m_element_editor);
|
||||
else continue;
|
||||
|
||||
if (QGraphicsItem *qgi = dynamic_cast<QGraphicsItem *>(cep))
|
||||
@@ -1000,7 +992,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document)
|
||||
|
||||
loaded_parts<<qgi;
|
||||
|
||||
if(convertibleTextField)
|
||||
if(pdtf)
|
||||
pdtf->fromTextFieldXml(qde);
|
||||
else
|
||||
cep->fromXml(qde);
|
||||
|
||||
Reference in New Issue
Block a user