From eee109576102ca38106cb14285c96c73447a4def Mon Sep 17 00:00:00 2001 From: blacksun Date: Thu, 19 Jan 2017 14:18:41 +0000 Subject: [PATCH] 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 git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4858 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/conductor.cpp | 29 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 8318de134..18c204bb8 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -1499,15 +1499,26 @@ void Conductor::setSequenceNum(autonum::sequentialNumbers sn) */ 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); + } } /**