[qet] qet/qet: [5051] Forget file from previous comit

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 5051
Author:   blacksun
Date:     2017-09-27 17:31:57 +0200 (Wed, 27 Sep 2017)
Log Message:
-----------
Forget file from previous comit

Modified Paths:
--------------
    trunk/sources/editor/elementscene.cpp

Modified: trunk/sources/editor/elementscene.cpp
===================================================================
--- trunk/sources/editor/elementscene.cpp	2017-09-27 15:26:47 UTC (rev 5050)
+++ trunk/sources/editor/elementscene.cpp	2017-09-27 15:31:57 UTC (rev 5051)
@@ -939,6 +939,8 @@
 				if (qde.isNull())
 					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);
@@ -947,9 +949,17 @@
 				else if (qde.tagName() == "polygon")  cep = new PartPolygon  (m_element_editor);
 				else if (qde.tagName() == "terminal") cep = new PartTerminal (m_element_editor);
 				else if (qde.tagName() == "text")     cep = new PartText     (m_element_editor);
-				else if (qde.tagName() == "input")    cep = new PartTextField(m_element_editor);
 				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 continue;
 				
 				if (QGraphicsItem *qgi = dynamic_cast<QGraphicsItem *>(cep))
@@ -958,7 +968,11 @@
 						qgi->setZValue(z++);
 					
 					loaded_parts<<qgi;
-					cep->fromXml(qde);
+					
+					if(convertibleTextField)
+						pdtf->fromTextFieldXml(qde);
+					else
+						cep->fromXml(qde);
 				}
 				else
 					delete cep;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/