[qet] [1944] Fixed ghost elements.

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


Revision: 1944
Author:   xavier
Date:     2012-09-27 20:59:16 +0200 (Thu, 27 Sep 2012)
Log Message:
-----------
Fixed ghost elements.

Modified Paths:
--------------
    trunk/sources/ghostelement.cpp
    trunk/sources/ghostelement.h

Modified: trunk/sources/ghostelement.cpp
===================================================================
--- trunk/sources/ghostelement.cpp	2012-09-26 05:54:32 UTC (rev 1943)
+++ trunk/sources/ghostelement.cpp	2012-09-27 18:59:16 UTC (rev 1944)
@@ -19,6 +19,7 @@
 #include "qet.h"
 #include "terminal.h"
 #include "elementtextitem.h"
+#include "diagramcommands.h"
 
 /**
 	Constructeur
@@ -53,7 +54,7 @@
 	ajouter les bons couples (id, adresse).
 	@return true si l'import a reussi, false sinon
 */
-bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
+bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool handle_inputs_rotation) {
 	// instancie les bornes decrites dans l'element XML
 	terminalsFromXml(e, table_id_adr);
 	
@@ -78,14 +79,19 @@
 	// on peut desormais confectionner le rendu de l'element
 	generateDrawings();
 	
-	// position, selection et orientation
+	// position, selection
 	setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
 	setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+	
+	// orientation
 	bool conv_ok;
 	int read_ori = e.attribute("orientation").toInt(&conv_ok);
 	if (!conv_ok || read_ori < 0 || read_ori > 3) read_ori = ori.defaultOrientation();
-	setOrientation((QET::Orientation)read_ori);
-	
+	if (handle_inputs_rotation) {
+		RotateElementsCommand::rotateElement(this, (QET::Orientation)read_ori);
+	} else {
+		setOrientation((QET::Orientation)read_ori);
+	}
 	return(true);
 }
 

Modified: trunk/sources/ghostelement.h
===================================================================
--- trunk/sources/ghostelement.h	2012-09-26 05:54:32 UTC (rev 1943)
+++ trunk/sources/ghostelement.h	2012-09-27 18:59:16 UTC (rev 1944)
@@ -44,7 +44,7 @@
 	
 	// methodes
 	public:
-	bool fromXml(QDomElement &, QHash<int, Terminal *> &);
+	virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false);
 	
 	protected:
 	QRectF minimalBoundingRect() const;


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