From e73bad2bd61f5bc6a08412e4621391effb23b250 Mon Sep 17 00:00:00 2001 From: blacksun Date: Sun, 17 May 2015 17:47:50 +0000 Subject: [PATCH] Minor fix : load an element or image will setpos at the same pos when was save (and not snap to grid) git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3973 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/diagramimageitem.cpp | 3 ++- sources/qetgraphicsitem/element.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sources/qetgraphicsitem/diagramimageitem.cpp b/sources/qetgraphicsitem/diagramimageitem.cpp index 9413a58bb..2ec56c1a9 100644 --- a/sources/qetgraphicsitem/diagramimageitem.cpp +++ b/sources/qetgraphicsitem/diagramimageitem.cpp @@ -142,7 +142,8 @@ bool DiagramImageItem::fromXml(const QDomElement &e) { 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); diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index f8f368f4f..ba2004a5b 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -417,8 +417,9 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool //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