[qet] qet/qet: [4858] Minor fix : Conductor 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: 4858
Author:   blacksun
Date:     2017-01-19 15:18:41 +0100 (Thu, 19 Jan 2017)
Log Message:
-----------
Minor fix : Conductor 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/conductor.cpp

Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp	2017-01-19 12:43:40 UTC (rev 4857)
+++ trunk/sources/qetgraphicsitem/conductor.cpp	2017-01-19 14:18:41 UTC (rev 4858)
@@ -1499,15 +1499,26 @@
  */
 void Conductor::setUpConnectionForFormula(QString old_formula, QString new_formula)
 {
-	if (diagram() && old_formula.contains("%id"))
-		disconnect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
-
-		//Label is frozen, so we don't update it.
-	if (m_freeze_label == true)
-		return;
-
-	if (diagram() && new_formula.contains("%id"))
-		connect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
+	if (diagram())
+	{
+			//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 (old_formula.contains("%F"))
+			old_formula.replace("%F", diagram()->border_and_titleblock.folio());
+		
+		if (old_formula.contains("%id"))
+			disconnect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
+		
+			//Label is frozen, so we don't update it.
+		if (m_freeze_label == true)
+			return;
+		
+		if (new_formula.contains("%F"))
+			new_formula.replace("%F", diagram()->border_and_titleblock.folio());
+		
+		if (new_formula.contains("%id"))
+			connect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Conductor::refreshText);
+	}
 }
 
 /**


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