From 5bb0a3f0a320488c2b029cd31ba8cb90cd0f208f Mon Sep 17 00:00:00 2001 From: blacksun Date: Fri, 27 Oct 2017 18:44:37 +0000 Subject: [PATCH] minor fix git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5087 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/dynamicelementtextitem.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 505b15448..06f751204 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -896,6 +896,12 @@ void DynamicElementTextItem::updateReportText() } } +/** + * @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 @@ void DynamicElementTextItem::updateLabel() 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)); }