[qet] qet/qet: [4859] Minor fix : Element keep up to date there label, when the formula contain the variable %F, and the text pointed by %F contain the variable %id

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


Revision: 4859
Author:   blacksun
Date:     2017-01-19 15:55:19 +0100 (Thu, 19 Jan 2017)
Log Message:
-----------
Minor fix : Element keep up to date there label, when the formula contain the variable %F, and the text pointed by %F contain the variable %id

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

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2017-01-19 14:18:41 UTC (rev 4858)
+++ trunk/sources/qetgraphicsitem/element.cpp	2017-01-19 14:55:19 UTC (rev 4859)
@@ -874,6 +874,11 @@
  */
 void Element::setUpConnectionForFormula(QString old_formula, QString new_formula)
 {
+		//Because the variable %F is a reference to another text which can contain variables,
+		//we must to replace %F by the real text, to check if the real text contain the variable %id
+	if (diagram() && old_formula.contains("%F"))
+		old_formula.replace("%F", diagram()->border_and_titleblock.folio());
+
 	if (diagram() && (old_formula.contains("%f") || old_formula.contains("%id")))
 		disconnect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Element::updateLabel);
 	if (old_formula.contains("%l"))
@@ -884,7 +889,10 @@
 		//Label is frozen, so we don't update it.
 	if (m_freeze_label == true)
 		return;
-
+	
+	if (diagram() && new_formula.contains("%F"))
+		new_formula.replace("%F", diagram()->border_and_titleblock.folio());
+	
 	if (diagram() && (new_formula.contains("%f") || new_formula.contains("%id")))
 		connect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Element::updateLabel);
 	if (new_formula.contains("%l"))


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