[qet] qet/qet: [5267] Element editor : keep up to date the displayed text of dynamic text item when change the source of text.

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


Revision: 5267
Author:   blacksun
Date:     2018-03-11 17:26:02 +0100 (Sun, 11 Mar 2018)
Log Message:
-----------
Element editor : keep up to date the displayed text of dynamic text item when change the source of text.

Modified Paths:
--------------
    trunk/sources/editor/graphicspart/partdynamictextfield.cpp

Modified: trunk/sources/editor/graphicspart/partdynamictextfield.cpp
===================================================================
--- trunk/sources/editor/graphicspart/partdynamictextfield.cpp	2018-03-11 16:04:44 UTC (rev 5266)
+++ trunk/sources/editor/graphicspart/partdynamictextfield.cpp	2018-03-11 16:26:02 UTC (rev 5267)
@@ -232,6 +232,20 @@
 void PartDynamicTextField::setTextFrom(DynamicElementTextItem::TextFrom text_from)
 {
 	m_text_from = text_from;
+	switch (m_text_from)
+	{
+		case DynamicElementTextItem::UserText:
+			setPlainText(m_text);
+			break;
+		case DynamicElementTextItem::ElementInfo:
+			setInfoName(m_info_name);
+			break;
+		case DynamicElementTextItem::CompositeText:
+			setCompositeText(m_composite_text);
+			break;
+		default:
+			break;
+	}
 	emit textFromChanged(m_text_from);
 }
 
@@ -258,6 +272,8 @@
 void PartDynamicTextField::setInfoName(const QString &info_name)
 {
 	m_info_name = info_name;
+	if(m_text_from == DynamicElementTextItem::ElementInfo && elementScene())
+		setPlainText(elementScene()->elementInformation().value(m_info_name).toString());
 	emit infoNameChanged(m_info_name);
 }
 
@@ -277,7 +293,7 @@
 void PartDynamicTextField::setCompositeText(const QString &text)
 {
 	m_composite_text = text;
-	if(elementScene())
+	if(m_text_from == DynamicElementTextItem::CompositeText && elementScene())
 		setPlainText(autonum::AssignVariables::replaceVariable(m_composite_text, elementScene()->elementInformation()));
 	emit compositeTextChanged(m_composite_text);
 }


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