[qet] [3973] Minor fix : load an element or image will setpos at the same pos when was save ( and not snap to grid)

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


Revision: 3973
Author:   blacksun
Date:     2015-05-17 19:47:50 +0200 (Sun, 17 May 2015)
Log Message:
-----------
Minor fix : load an element or image will setpos at the same pos when was save (and not snap to grid)

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/diagramimageitem.cpp
    trunk/sources/qetgraphicsitem/element.cpp

Modified: trunk/sources/qetgraphicsitem/diagramimageitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/diagramimageitem.cpp	2015-05-15 10:32:11 UTC (rev 3972)
+++ trunk/sources/qetgraphicsitem/diagramimageitem.cpp	2015-05-17 17:47:50 UTC (rev 3973)
@@ -142,7 +142,8 @@
 
 	setScale(e.attribute("size").toDouble());
 	applyRotation(e.attribute("rotation").toDouble());
-	setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
+		//We directly call setPos from QGraphicsObject, because QetGraphicsItem will snap to grid
+	QGraphicsObject::setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
 	is_movable_ = (e.attribute("is_movable").toInt());
 
 	return (true);

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2015-05-15 10:32:11 UTC (rev 3972)
+++ trunk/sources/qetgraphicsitem/element.cpp	2015-05-17 17:47:50 UTC (rev 3973)
@@ -417,8 +417,9 @@
 	//load informations
 	element_informations_.fromXml(e.firstChildElement("elementInformations"), "elementInformation");
 
-	// position, selection
-	setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
+		//Position and selection.
+		//We directly call setPos from QGraphicsObject, because QetGraphicsItem will snap to grid
+	QGraphicsObject::setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
 	setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
 	
 	// orientation


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