[qet] qet/qet: [5084] When parse the defintion of an element in the diagram editor, befor parse anything, we get every DomElement with tagg "input".

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


Revision: 5084
Author:   blacksun
Date:     2017-10-21 14:05:57 +0200 (Sat, 21 Oct 2017)
Log Message:
-----------
When parse the defintion of an element in the diagram editor, befor parse anything, we get every DomElement with tagg "input".
If no one of these "input" have the attribute "tagg" set to "label", we set it to the first "input"  

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/customelement.cpp

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2017-10-19 09:10:23 UTC (rev 5083)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2017-10-21 12:05:57 UTC (rev 5084)
@@ -164,6 +164,22 @@
 		
 		if (elmts.tagName() == "description")
 		{
+				//Minor workaround to find if there is a "input" tagg as label.
+				//If not, we set the tagg "label" to the first "input.
+			QList <QDomElement> input_field;
+			bool have_label = false;
+			for (QDomElement input_node = node.firstChildElement("input") ; !input_node.isNull() ; input_node = input_node.nextSiblingElement("input"))
+			{
+				if (!input_node.isNull())
+				{
+					input_field << input_node;
+					if (input_node.attribute("tagg", "none") == "label")
+						have_label = true;
+				}
+			}
+			if(!have_label && !input_field.isEmpty())
+				input_field.first().setAttribute("tagg", "label");
+			
 				//Manage the graphic description = part of drawing
 			for (QDomNode n = node.firstChild() ; !n.isNull() ; n = n.nextSibling())
 			{


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