[qet] [4598] Don't clear the texts of pasted elements.

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


Revision: 4598
Author:   blacksun
Date:     2016-07-30 15:36:24 +0200 (Sat, 30 Jul 2016)
Log Message:
-----------
Don't clear the texts of pasted elements.
For report element, clear the function and tension-protocol texts

Modified Paths:
--------------
    trunk/sources/diagramcommands.cpp
    trunk/sources/qetgraphicsitem/customelement.cpp

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2016-07-28 15:48:35 UTC (rev 4597)
+++ trunk/sources/diagramcommands.cpp	2016-07-30 13:36:24 UTC (rev 4598)
@@ -173,16 +173,26 @@
 	if (first_redo) {
 		first_redo = false;
 
-		//this is the first paste, we do some actions for the new element
+			//this is the first paste, we do some actions for the new element
 		foreach(Element *e, content.elements) {
-			//make new uuid, because old uuid are the uuid of the copied element
+				//make new uuid, because old uuid are the uuid of the copied element
 			e -> newUuid();
 
-			//Reset the text of report element
+				//Reset the text of report element
 			if (e -> linkType() & Element::AllReport) {
-				if (e->texts().size())
+
+					//Befor commit 3559 there isn't text field tagged label,
+					//so if not found we take the first text field
+				if (ElementTextItem *eti = e->taggedText("label"))
+					eti->setPlainText("/");
+				else if (e->texts().size())
 					e->texts().first()->setPlainText("/");
-			} else {
+
+				if (ElementTextItem *eti = e->taggedText("function"))
+					eti->setPlainText("_");
+				if (ElementTextItem *eti = e->taggedText("tension-protocol"))
+					eti->setPlainText("_");
+			} /*else {
 				//Reset the information about the label, the comment and location
 				e -> rElementInformations().addValue("label", "");
 				e -> rElementInformations().addValue("comment", "");
@@ -191,22 +201,23 @@
 				//Reset the text field tagged "label
 				if (ElementTextItem *eti = e ->taggedText("label"))
 				eti -> setPlainText("_");
-			}
+			}*/
 		}
 
-		//Reset the text of conductors
+			//Reset the text of conductors
 		foreach (Conductor *c, content.conductorsToMove) {
 			ConductorProperties cp = c -> properties();
 			cp.text = c->diagram() ? c -> diagram() -> defaultConductorProperties.text : "_";
 			c -> setProperties(cp);
 		}
 	}
-	else
-	{
+	else {
 		foreach (QGraphicsItem *item, content.items(filter))
 			diagram->addItem(item);
 	}
-	foreach (QGraphicsItem *qgi, content.items()) qgi -> setSelected(true);
+
+	foreach (QGraphicsItem *qgi, content.items())
+		qgi -> setSelected(true);
 }
 
 /**

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2016-07-28 15:48:35 UTC (rev 4597)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2016-07-30 13:36:24 UTC (rev 4598)
@@ -1077,6 +1077,8 @@
 /**
  * @brief CustomElement::taggedText
  * return the text field tagged with @tagg or NULL if text field isn't found
+ * Some of available taggs :
+ * function, tension-protocol, label, comment, location
  * @param tagg
  */
 ElementTextItem* CustomElement::taggedText(const QString &tagg) const {


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