From 43dbc4aa0ad01a3d1c72b49ead930664240362e3 Mon Sep 17 00:00:00 2001 From: blacksun Date: Thu, 19 Jan 2017 14:55:19 +0000 Subject: [PATCH] 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 git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4859 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/element.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 7dbc730c9..138f6ea1c 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -874,6 +874,11 @@ void Element::freezeNewAddedElement() { */ 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 @@ void Element::setUpConnectionForFormula(QString old_formula, QString new_formula //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"))