[qet] [820] Corrections sur le calcul des positions des champs de texte dynamiques.

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


Revision: 820
Author:   xavier
Date:     2009-12-27 23:46:35 +0100 (Sun, 27 Dec 2009)
Log Message:
-----------
Corrections sur le calcul des positions des champs de texte dynamiques.

Modified Paths:
--------------
    branches/0.3/sources/editor/parttextfield.cpp
    branches/0.3/sources/elementtextitem.cpp

Modified: branches/0.3/sources/editor/parttextfield.cpp
===================================================================
--- branches/0.3/sources/editor/parttextfield.cpp	2009-12-27 20:48:19 UTC (rev 819)
+++ branches/0.3/sources/editor/parttextfield.cpp	2009-12-27 22:46:35 UTC (rev 820)
@@ -111,10 +111,10 @@
 
 /**
 	Specifie la position du champ de texte
-	@param left_corner_pos Nouvelle position
+	@param new_pos Nouvelle position
 */
-void PartTextField::setPos(const QPointF &left_corner_pos) {
-	QGraphicsTextItem::setPos(left_corner_pos - margin());
+void PartTextField::setPos(const QPointF &new_pos) {
+	QGraphicsTextItem::setPos(new_pos - margin());
 }
 
 /**
@@ -168,10 +168,11 @@
 }
 
 /**
-	@return Les coordonnees du point situe en bas a gauche du texte.
+	@return le decalage entre l'origine du QGraphicsItem et l'origine du champ de
+	texte.
 */
 QPointF PartTextField::margin() const {
-	return(QPointF(0.0, boundingRect().height() / 2.0));
+	return(QPointF(0.0, boundingRect().bottom() / 2.0));
 }
 
 /**
@@ -256,9 +257,9 @@
 */
 QVariant PartTextField::property(const QString &property) {
 	if (property == "x") {
-		return((scenePos() + margin()).x());
+		return(pos().x());
 	} else if (property == "y") {
-		return((scenePos() + margin()).y());
+		return(pos().y());
 	} else if (property == "size") {
 		return(font().pointSize());
 	} else if (property == "text") {
@@ -320,7 +321,7 @@
 	painter -> setPen(Qt::red);
 	drawPoint(painter, QPointF(0, 0));
 	
-	painter -> setPen(Qt::green);
+	painter -> setPen(QColor("#800000"));
 	drawPoint(painter, mapFromScene(pos()));
 #endif
 }

Modified: branches/0.3/sources/elementtextitem.cpp
===================================================================
--- branches/0.3/sources/elementtextitem.cpp	2009-12-27 20:48:19 UTC (rev 819)
+++ branches/0.3/sources/elementtextitem.cpp	2009-12-27 22:46:35 UTC (rev 820)
@@ -66,7 +66,7 @@
 */
 void ElementTextItem::setPos(const QPointF &pos) {
 	QPointF actual_pos = pos;
-	actual_pos -= QPointF(0.0, boundingRect().height() / 2.0);
+	actual_pos -= QPointF(0.0, boundingRect().bottom() / 2.0);
 	QGraphicsTextItem::setPos(actual_pos);
 }
 
@@ -84,7 +84,7 @@
 */
 QPointF ElementTextItem::pos() const {
 	QPointF actual_pos = DiagramTextItem::pos();
-	actual_pos += QPointF(0.0, boundingRect().height() / 2.0);
+	actual_pos += QPointF(0.0, boundingRect().bottom() / 2.0);
 	return(actual_pos);
 }
 
@@ -174,7 +174,7 @@
 	@param angle Angle de la rotation a effectuer
 */
 void ElementTextItem::applyRotation(const qreal &angle) {
-	qreal origin_offset = boundingRect().height() / 2.0;
+	qreal origin_offset = boundingRect().bottom() / 2.0;
 	
 	QTransform rotation;
 	rotation.translate(0.0,  origin_offset);


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