[qet] [2066] Add a new property to automatically detect HTML markup and display rich text in a text field .

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


Revision: 2066
Author:   scorpio810
Date:     2013-03-23 00:17:39 +0100 (Sat, 23 Mar 2013)
Log Message:
-----------
Add a new property to automatically detect HTML markup and display rich text in a text field .

Modified Paths:
--------------
    trunk/sources/diagramcommands.cpp
    trunk/sources/diagramtextitem.cpp
    trunk/sources/independenttextitem.cpp

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2013-03-17 20:54:53 UTC (rev 2065)
+++ trunk/sources/diagramcommands.cpp	2013-03-22 23:17:39 UTC (rev 2066)
@@ -557,7 +557,7 @@
 
 /// annule la modification de texte
 void ChangeDiagramTextCommand::undo() {
-	text_item -> setPlainText(text_before);
+	text_item -> setHtml(text_before);
 }
 
 /// refait la modification de texte
@@ -565,7 +565,7 @@
 	if (first_redo) {
 		first_redo = false;
 	} else {
-		text_item -> setPlainText(text_after);
+		text_item -> setHtml(text_after);
 	}
 }
 

Modified: trunk/sources/diagramtextitem.cpp
===================================================================
--- trunk/sources/diagramtextitem.cpp	2013-03-17 20:54:53 UTC (rev 2065)
+++ trunk/sources/diagramtextitem.cpp	2013-03-22 23:17:39 UTC (rev 2066)
@@ -202,7 +202,7 @@
 	setFlag(QGraphicsItem::ItemIsMovable, false);
 	
 	// memorise le texte avant que l'utilisateur n'y touche
-	previous_text_ = toPlainText();
+	previous_text_ = toHtml();
 	// cela permettra de determiner si l'utilisateur a modifie le texte a la fin de l'edition
 }
 
@@ -215,8 +215,8 @@
 	
 	// signale la modification du texte si besoin
 	if (toPlainText() != previous_text_) {
-		emit(diagramTextChanged(this, previous_text_, toPlainText()));
-		previous_text_ = toPlainText();
+		emit(diagramTextChanged(this, previous_text_, toHtml()));
+		previous_text_ = toHtml();
 	}
 	
 	// deselectionne le texte

Modified: trunk/sources/independenttextitem.cpp
===================================================================
--- trunk/sources/independenttextitem.cpp	2013-03-17 20:54:53 UTC (rev 2065)
+++ trunk/sources/independenttextitem.cpp	2013-03-22 23:17:39 UTC (rev 2066)
@@ -51,7 +51,7 @@
 */
 void IndependentTextItem::fromXml(const QDomElement &e) {
 	setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
-	setPlainText(e.attribute("text"));
+	setHtml(e.attribute("text"));
 	setRotationAngle(e.attribute("rotation").toDouble());
 }
 
@@ -63,7 +63,7 @@
 	QDomElement result = document.createElement("input");
 	result.setAttribute("x", QString("%1").arg(pos().x()));
 	result.setAttribute("y", QString("%1").arg(pos().y()));
-	result.setAttribute("text", toPlainText());
+	result.setAttribute("text", toHtml());
 	if (rotationAngle()) {
 		result.setAttribute("rotation", QString("%1").arg(rotationAngle()));
 	}


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