[qet] qet/qet: [5087] minor fix

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


Revision: 5087
Author:   blacksun
Date:     2017-10-27 20:44:37 +0200 (Fri, 27 Oct 2017)
Log Message:
-----------
minor fix

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

Modified: trunk/sources/qetgraphicsitem/dynamicelementtextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/dynamicelementtextitem.cpp	2017-10-26 17:12:49 UTC (rev 5086)
+++ trunk/sources/qetgraphicsitem/dynamicelementtextitem.cpp	2017-10-27 18:44:37 UTC (rev 5087)
@@ -896,6 +896,12 @@
 	}
 }
 
+/**
+ * @brief DynamicElementTextItem::updateLabel
+ * Update the displayed text, when this dynamic text is based on the label of the parent element.
+ * This function is notably use when the label itself is based from a formula.
+ * If this dynamic text isn't based on label, this function do nothing.
+ */
 void DynamicElementTextItem::updateLabel()
 {
 	if ((m_text_from == ElementInfo && m_info_name == "label") ||
@@ -908,7 +914,12 @@
 		Element *element = elementUseForInfo();
 		
 		if(m_text_from == ElementInfo)
-			setPlainText(autonum::AssignVariables::formulaToLabel(dc.value("formula").toString(), element->rSequenceStruct(), element->diagram(), element));
+		{
+			if(dc.value("formula").toString().isEmpty())
+				setPlainText(dc.value("label").toString());
+			else
+				setPlainText(autonum::AssignVariables::formulaToLabel(dc.value("formula").toString(), element->rSequenceStruct(), element->diagram(), element));
+		}
 		else if (m_text_from == CompositeText)
 			setPlainText(autonum::AssignVariables::replaceVariable(m_composite_text, dc));
 	}


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