[qet] [3547] Minor change according to the evolution of Qt class ( remove QGraphicsScene from constructor of QGraphicsItem).

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


Revision: 3547
Author:   blacksun
Date:     2014-12-14 14:06:21 +0100 (Sun, 14 Dec 2014)
Log Message:
-----------
Minor change according to the evolution of Qt class (remove QGraphicsScene from constructor of QGraphicsItem).

Modified Paths:
--------------
    trunk/sources/diagram.cpp
    trunk/sources/diagramview.cpp
    trunk/sources/elementscollectioncache.cpp
    trunk/sources/elementspanel.cpp
    trunk/sources/factory/elementfactory.cpp
    trunk/sources/factory/elementfactory.h
    trunk/sources/qetgraphicsitem/conductor.cpp
    trunk/sources/qetgraphicsitem/conductor.h
    trunk/sources/qetgraphicsitem/conductortextitem.cpp
    trunk/sources/qetgraphicsitem/conductortextitem.h
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/qetgraphicsitem/customelement.h
    trunk/sources/qetgraphicsitem/diagramtextitem.cpp
    trunk/sources/qetgraphicsitem/diagramtextitem.h
    trunk/sources/qetgraphicsitem/element.cpp
    trunk/sources/qetgraphicsitem/element.h
    trunk/sources/qetgraphicsitem/elementtextitem.cpp
    trunk/sources/qetgraphicsitem/elementtextitem.h
    trunk/sources/qetgraphicsitem/fixedelement.cpp
    trunk/sources/qetgraphicsitem/fixedelement.h
    trunk/sources/qetgraphicsitem/ghostelement.cpp
    trunk/sources/qetgraphicsitem/ghostelement.h
    trunk/sources/qetgraphicsitem/independenttextitem.cpp
    trunk/sources/qetgraphicsitem/independenttextitem.h
    trunk/sources/qetgraphicsitem/masterelement.cpp
    trunk/sources/qetgraphicsitem/masterelement.h
    trunk/sources/qetgraphicsitem/reportelement.cpp
    trunk/sources/qetgraphicsitem/reportelement.h
    trunk/sources/qetgraphicsitem/simpleelement.cpp
    trunk/sources/qetgraphicsitem/simpleelement.h
    trunk/sources/qetgraphicsitem/slaveelement.cpp
    trunk/sources/qetgraphicsitem/slaveelement.h
    trunk/sources/qetgraphicsitem/terminal.cpp
    trunk/sources/qetgraphicsitem/terminal.h

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/diagram.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -555,7 +555,7 @@
 		if (type_id.startsWith("embed://")) element_location.setProject(project_);
 		
 		int state = 0;
-		Element *nvel_elmt = ElementFactory::Instance()->createElement(element_location, 0, this, &state);
+		Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, 0, &state);
 		if (state) {
 			QString debug_message = QString("Diagram::fromXml() : Le chargement de la description de l'element %1 a echoue avec le code d'erreur %2").arg(element_location.path()).arg(state);
 			qDebug() << qPrintable(debug_message);
@@ -579,7 +579,7 @@
 	// Load text
 	QList<IndependentTextItem *> added_texts;
 	foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) {
-		IndependentTextItem *iti = new IndependentTextItem(this);
+		IndependentTextItem *iti = new IndependentTextItem();
 		iti -> fromXml(text_xml);
 		addItem(iti);
 		added_texts << iti;
@@ -623,8 +623,9 @@
 					}
 				}
 				if (can_add_conductor) {
-					Conductor *c = new Conductor(table_adr_id.value(id_p1), table_adr_id.value(id_p2), this);
+					Conductor *c = new Conductor(table_adr_id.value(id_p1), table_adr_id.value(id_p2));
 					c -> fromXml(f);
+					addItem(c);
 					added_conductors << c;
 				}
 			}

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/diagramview.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -314,7 +314,7 @@
 void DiagramView::handleTextDrop(QDropEvent *e) {
 	if (scene -> isReadOnly() || (e -> mimeData() -> hasText() == false) ) return;
 
-	IndependentTextItem *iti = new IndependentTextItem (e -> mimeData() -> text(), scene);
+	IndependentTextItem *iti = new IndependentTextItem (e -> mimeData() -> text());
 
 	if (e -> mimeData() -> hasHtml()) {
 		iti -> setHtml (e -> mimeData() -> text());
@@ -863,7 +863,7 @@
 bool DiagramView::addElementAtPos(const ElementsLocation &location, const QPoint &pos) {
 	// construit une instance de l'element correspondant a l'emplacement
 	int state;
-	Element *el = ElementFactory::Instance()->createElement(location, 0, diagram(), &state);
+	Element *el = ElementFactory::Instance()->createElement(location, 0, &state);
 	if (state) {
 		delete el;
 		return(false);

Modified: trunk/sources/elementscollectioncache.cpp
===================================================================
--- trunk/sources/elementscollectioncache.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/elementscollectioncache.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -196,7 +196,7 @@
 */
 bool ElementsCollectionCache::fetchData(const ElementsLocation &location) {
 	int state;
-	Element *custom_elmt = ElementFactory::Instance()->createElement(location, 0, 0, &state);
+	Element *custom_elmt = ElementFactory::Instance() -> createElement(location, 0, &state);
 	if (state) {
 		qDebug() << "ElementsCollectionCache::fetchData() : Le chargement du composant" << qPrintable(location.toString()) << "a echoue avec le code d'erreur" << state;
 	} else {

Modified: trunk/sources/elementspanel.cpp
===================================================================
--- trunk/sources/elementspanel.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/elementspanel.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -294,7 +294,7 @@
 		
 		// element temporaire pour fournir un apercu
 		int elmt_creation_state;
-		Element *temp_elmt = ElementFactory::Instance()->createElement(location, 0, 0, &elmt_creation_state);
+		Element *temp_elmt = ElementFactory::Instance() -> createElement(location, 0, &elmt_creation_state);
 		if (elmt_creation_state) {
 			delete temp_elmt;
 			return;

Modified: trunk/sources/factory/elementfactory.cpp
===================================================================
--- trunk/sources/factory/elementfactory.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/factory/elementfactory.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -31,29 +31,31 @@
  * @brief ElementFactory::createElement
  * @param location create element at this location
  * @param qgi parent item for this elemnt
- * @param s diagram of the element
  * @param state state of the creation
  * @return the element or 0
  */
-Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) {
-	// recupere la definition de l'element
+Element * ElementFactory::createElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state)
+{
+		// recupere la definition de l'element
 	ElementsCollectionItem *element_item = QETApp::collectionItem(location);
 	ElementDefinition *element_definition;
 	if (!element_item ||\
 		!element_item -> isElement() ||\
-		!(element_definition = qobject_cast<ElementDefinition *>(element_item))) {
+		!(element_definition = qobject_cast<ElementDefinition *>(element_item)))
+	{
 		if (state) *state = 1;
 		return 0;
 	}
 
-	if (element_definition->xml().hasAttribute("link_type")) {
+	if (element_definition->xml().hasAttribute("link_type"))
+	{
 		QString link_type = element_definition->xml().attribute("link_type");
-		if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, s, state));
-		if (link_type == "master")   return (new MasterElement   (location, qgi, s, state));
-		if (link_type == "slave")    return (new SlaveElement    (location, qgi, s, state));
-		if (link_type == "terminal") return (new TerminalElement (location, qgi, s, state));
+		if (link_type == "next_report" || link_type == "previous_report") return (new ReportElement(location, link_type, qgi, state));
+		if (link_type == "master")   return (new MasterElement   (location, qgi, state));
+		if (link_type == "slave")    return (new SlaveElement    (location, qgi, state));
+		if (link_type == "terminal") return (new TerminalElement (location, qgi, state));
 	}
 	
-	//default if nothing match for link_type
-	return (new SimpleElement(location, qgi, s, state));
+		//default if nothing match for link_type
+	return (new SimpleElement(location, qgi, state));
 }

Modified: trunk/sources/factory/elementfactory.h
===================================================================
--- trunk/sources/factory/elementfactory.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/factory/elementfactory.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -33,41 +33,43 @@
  */
 class ElementFactory
 {
-	//methods for singleton pattern
+		//methods for singleton pattern
 	public:
-	// return instance of factory
-	static ElementFactory* Instance() {
-		static QMutex mutex;
-		if (!factory_) {
-			mutex.lock();
-			if (!factory_) factory_ = new ElementFactory();
-			mutex.unlock();
+			// return instance of factory
+		static ElementFactory* Instance() {
+			static QMutex mutex;
+			if (!factory_) {
+				mutex.lock();
+				if (!factory_) factory_ = new ElementFactory();
+				mutex.unlock();
+			}
+			return factory_;
 		}
-		return factory_;
-	}
-	// delete the instance of factory
-	static void dropInstance () {
-		static QMutex mutex;
-		if (factory_) {
-			mutex.lock();
-			delete factory_;
-			factory_ = 0;
-			mutex.unlock();
+
+			// delete the instance of factory
+		static void dropInstance () {
+			static QMutex mutex;
+			if (factory_) {
+				mutex.lock();
+				delete factory_;
+				factory_ = 0;
+				mutex.unlock();
+			}
 		}
-	}
-	//attributes
+
+		//attributes
 	private:
-	static ElementFactory* factory_;
+		static ElementFactory* factory_;
 
-	//methods for the class factory himself
+		//methods for the class factory himself
 	private:
-	ElementFactory() {}
-	ElementFactory (const ElementFactory &);
-	ElementFactory operator= (const ElementFactory &);
-	~ElementFactory() {}
+		ElementFactory() {}
+		ElementFactory (const ElementFactory &);
+		ElementFactory operator= (const ElementFactory &);
+		~ElementFactory() {}
 
 	public:
-	Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+		Element * createElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
 };
 //ElementFactory ElementFactory::factory_ = 0;
 #endif // ELEMENTFACTORY_H

Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/conductor.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -39,9 +39,9 @@
 	@param p2              Seconde Borne a laquelle le conducteur est lie
 	@param parent_diagram  QGraphicsScene a laquelle appartient le conducteur
 */
-Conductor::Conductor(Terminal *p1, Terminal* p2, Diagram *parent_diagram) :
+Conductor::Conductor(Terminal *p1, Terminal* p2) :
 	QObject(),
-	QGraphicsPathItem(0, parent_diagram),
+	QGraphicsPathItem(0),
 	terminal1(p1),
 	terminal2(p2),
 	bMouseOver(false),

Modified: trunk/sources/qetgraphicsitem/conductor.h
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/conductor.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -41,14 +41,14 @@
 	Q_PROPERTY(QPointF pos READ pos WRITE setPos)
 	Q_PROPERTY(int animPath READ fakePath WRITE updatePathAnimate)
 	
-	// constructors, destructor
+		// constructors, destructor
 	public:
-	Conductor(Terminal *, Terminal *, Diagram * = 0);
-	virtual ~Conductor();
+		Conductor(Terminal *, Terminal *);
+		virtual ~Conductor();
 	
 	private:
-	Conductor(const Conductor &);
-	
+		Conductor(const Conductor &);
+
 	// attributes
 	public:
 	enum { Type = UserType + 1001 };

Modified: trunk/sources/qetgraphicsitem/conductortextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductortextitem.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/conductortextitem.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -25,8 +25,8 @@
 	@param parent_conductor  Conducteur auquel ce texte est rattache
 	@param parent_diagram    Schema auquel ce texte et son conducteur parent sont rattaches
 */
-ConductorTextItem::ConductorTextItem(Conductor *parent_conductor, Diagram *parent_diagram) :
-	DiagramTextItem(parent_conductor, parent_diagram),
+ConductorTextItem::ConductorTextItem(Conductor *parent_conductor) :
+	DiagramTextItem(parent_conductor),
 	parent_conductor_(parent_conductor),
 	moved_by_user_(false),
 	rotate_by_user_(false)
@@ -40,8 +40,8 @@
 	@param parent_conductor  Conducteur auquel ce texte est rattache
 	@param parent_diagram    Schema auquel ce texte et son conducteur parent sont rattaches
 */
-ConductorTextItem::ConductorTextItem(const QString &text, Conductor *parent_conductor, Diagram *parent_diagram) :
-	DiagramTextItem(text, parent_conductor, parent_diagram),
+ConductorTextItem::ConductorTextItem(const QString &text, Conductor *parent_conductor) :
+	DiagramTextItem(text, parent_conductor),
 	parent_conductor_(parent_conductor),
 	moved_by_user_(false),
 	rotate_by_user_(false)

Modified: trunk/sources/qetgraphicsitem/conductortextitem.h
===================================================================
--- trunk/sources/qetgraphicsitem/conductortextitem.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/conductortextitem.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -31,8 +31,8 @@
 	
 	// constructors, destructor
 	public:
-	ConductorTextItem(Conductor * = 0, Diagram * = 0);
-	ConductorTextItem(const QString &, Conductor * = 0, Diagram * = 0);
+	ConductorTextItem(Conductor * = 0);
+	ConductorTextItem(const QString &, Conductor * = 0);
 	virtual ~ConductorTextItem();
 	private:
 	ConductorTextItem(const ConductorTextItem &);

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -44,8 +44,8 @@
 		- 7 : L'analyse d'un element XML decrivant une partie du dessin de l'element a echoue
 		- 8 : Aucune partie du dessin n'a pu etre chargee
 */
-CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
-	FixedElement(qgi, s),
+CustomElement::CustomElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
+	FixedElement(qgi),
 	elmt_state(-1),
 	location_(location),
 	forbid_antialiasing(false)
@@ -759,7 +759,7 @@
 	else if (e.attribute("orientation") == "e") terminalo = Qet::East;
 	else if (e.attribute("orientation") == "w") terminalo = Qet::West;
 	else return(0);
-	Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this, qobject_cast<Diagram *>(scene()));
+	Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
 	new_terminal -> setZValue(420); // valeur arbitraire pour maintenir les bornes au-dessus des champs de texte
 	list_terminals << new_terminal;
 	return(new_terminal);

Modified: trunk/sources/qetgraphicsitem/customelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/customelement.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -36,7 +36,7 @@
 	
 	// constructors, destructor
 	public:
-	CustomElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+	CustomElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
 	virtual ~CustomElement();
 	
 	private:

Modified: trunk/sources/qetgraphicsitem/diagramtextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/diagramtextitem.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/diagramtextitem.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -26,8 +26,8 @@
 	@param parent Le QGraphicsItem parent du champ de texte
 	@param parent_diagram Le schema auquel appartient le champ de texte
 */
-DiagramTextItem::DiagramTextItem(QGraphicsItem *parent, Diagram *parent_diagram) :
-	QGraphicsTextItem(parent, parent_diagram),
+DiagramTextItem::DiagramTextItem(QGraphicsItem *parent) :
+	QGraphicsTextItem(parent),
 	bMouseOver(false),
 	previous_text_(),
 	rotation_angle_(0.0),
@@ -43,8 +43,8 @@
 	@param parent Le QGraphicsItem parent du champ de texte
 	@param parent_diagram Le schema auquel appartient le champ de texte
 */
-DiagramTextItem::DiagramTextItem(const QString &text, QGraphicsItem *parent, Diagram *parent_diagram) :
-	QGraphicsTextItem(text, parent, parent_diagram),
+DiagramTextItem::DiagramTextItem(const QString &text, QGraphicsItem *parent) :
+	QGraphicsTextItem(text, parent),
 	bMouseOver(false),
 	previous_text_(text),
 	rotation_angle_(0.0)

Modified: trunk/sources/qetgraphicsitem/diagramtextitem.h
===================================================================
--- trunk/sources/qetgraphicsitem/diagramtextitem.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/diagramtextitem.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -33,8 +33,8 @@
 	Q_OBJECT
 	// constructors, destructor
 	public:
-	DiagramTextItem(QGraphicsItem * = 0, Diagram * = 0);
-	DiagramTextItem(const QString &, QGraphicsItem * = 0, Diagram * = 0);
+	DiagramTextItem(QGraphicsItem * = 0);
+	DiagramTextItem(const QString &, QGraphicsItem * = 0);
 	virtual ~DiagramTextItem();
 
 	private:

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/element.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -30,14 +30,12 @@
 /**
 	Constructeur pour un element sans scene ni parent
 */
-Element::Element(QGraphicsItem *parent, Diagram *scene) :
+Element::Element(QGraphicsItem *parent) :
 	QetGraphicsItem(parent),
 	internal_connections_(false),
 	must_highlight_(false),
 	bMouseOver(false)
 {
-	Q_UNUSED(scene);
-
 	link_type_ = Simple;
 	uuid_ = QUuid::createUuid();
 	setZValue(10);

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/element.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -22,7 +22,6 @@
 #include "qetgraphicsitem.h"
 #include "diagramcontext.h"
 
-class Diagram;
 class ElementTextItem;
 class QETProject;
 class Terminal;
@@ -31,29 +30,28 @@
 /**
 	This is the base class for electrical elements.
 */
-class Element : public QetGraphicsItem {
-	
+class Element : public QetGraphicsItem {	
 	Q_OBJECT
 	
-	// constructors, destructor
+		// constructors, destructor
 	public:
-	Element(QGraphicsItem * = 0, Diagram * = 0);
-	virtual ~Element();	
+		Element(QGraphicsItem * = 0);
+		virtual ~Element();
 	private:
-	Element(const Element &);
+		Element(const Element &);
 	
-	// attributes
+		// attributes
 	public:
-	enum { Type = UserType + 1000 };
-	// this enum is use to know the kind of element and
-	// to use flag for element provider class
-	enum kind {Simple = 1,
-		  NextReport = 2,
-		  PreviousReport = 4,
-		  AllReport = 6,
-		  Master = 8,
-		  Slave = 16,
-		  Terminale = 32};
+		enum { Type = UserType + 1000 };
+		// this enum is use to know the kind of element and
+		// to use flag for element provider class
+		enum kind {Simple = 1,
+				   NextReport = 2,
+				   PreviousReport = 4,
+				   AllReport = 6,
+				   Master = 8,
+				   Slave = 16,
+				   Terminale = 32};
 	
 	private:
 	QSize   dimensions;

Modified: trunk/sources/qetgraphicsitem/elementtextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/elementtextitem.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/elementtextitem.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -26,8 +26,8 @@
 	@param parent_element Le QGraphicsItem parent du champ de texte
 	@param parent_diagram Le schema auquel appartient le champ de texte
 */
-ElementTextItem::ElementTextItem(Element *parent_element, Diagram *parent_diagram) :
-	DiagramTextItem(parent_element, parent_diagram),
+ElementTextItem::ElementTextItem(Element *parent_element) :
+	DiagramTextItem(parent_element),
 	parent_element_(parent_element),
 	follow_parent_rotations(false),
 	original_rotation_angle_(0.0)
@@ -39,8 +39,8 @@
 	@param parent_diagram Le schema auquel appartient le champ de texte
 	@param text Le texte affiche par le champ de texte
 */
-ElementTextItem::ElementTextItem(const QString &text, Element *parent_element, Diagram *parent_diagram) :
-	DiagramTextItem(text, parent_element, parent_diagram),
+ElementTextItem::ElementTextItem(const QString &text, Element *parent_element) :
+	DiagramTextItem(text, parent_element),
 	parent_element_(parent_element),
 	follow_parent_rotations(false),
 	original_rotation_angle_(0.0)

Modified: trunk/sources/qetgraphicsitem/elementtextitem.h
===================================================================
--- trunk/sources/qetgraphicsitem/elementtextitem.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/elementtextitem.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -20,7 +20,6 @@
 
 #include "diagramtextitem.h"
 
-class Diagram;
 class Element;
 
 /**
@@ -32,8 +31,8 @@
 	Q_OBJECT
 		// constructors, destructor
 	public:
-		ElementTextItem(Element * = 0, Diagram * = 0);
-		ElementTextItem(const QString &, Element * = 0, Diagram * = 0);
+		ElementTextItem(Element * = 0);
+		ElementTextItem(const QString &, Element * = 0);
 		virtual ~ElementTextItem();
 	
 		// attributes

Modified: trunk/sources/qetgraphicsitem/fixedelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/fixedelement.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/fixedelement.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -19,7 +19,7 @@
 /**
 	Constructeur
 */
-FixedElement::FixedElement(QGraphicsItem *parent, Diagram *scene) : Element(parent, scene) {
+FixedElement::FixedElement(QGraphicsItem *parent) : Element(parent) {
 }
 
 /**

Modified: trunk/sources/qetgraphicsitem/fixedelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/fixedelement.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/fixedelement.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -17,7 +17,9 @@
 */
 #ifndef ELEMENTFIXE_H
 #define ELEMENTFIXE_H
+
 #include "element.h"
+
 /**
 	This class represents an element having a fixed number of terminals.
 */
@@ -27,7 +29,7 @@
 	
 	// constructors, destructor
 	public:
-	FixedElement(QGraphicsItem * = 0, Diagram * = 0);
+	FixedElement(QGraphicsItem * = 0);
 	virtual ~FixedElement();
 	
 	// methods

Modified: trunk/sources/qetgraphicsitem/ghostelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/ghostelement.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/ghostelement.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -29,10 +29,9 @@
 */
 GhostElement::GhostElement(
 	const ElementsLocation &location,
-	QGraphicsItem *qgi,
-	Diagram *d
+	QGraphicsItem *qgi
 ) :
-	CustomElement(location, qgi, d)
+	CustomElement(location, qgi)
 {
 	QString tooltip_string = QString(
 		tr("<u>\311l\351ment manquant\240:</u> %1")

Modified: trunk/sources/qetgraphicsitem/ghostelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/ghostelement.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/ghostelement.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -18,7 +18,6 @@
 #ifndef GHOST_ELEMENT_H
 #define GHOST_ELEMENT_H
 #include "customelement.h"
-class Diagram;
 class QGraphicsItem;
 class ElementsLocation;
 class Terminal;
@@ -37,7 +36,7 @@
 	
 	// constructor, destructor
 	public:
-	GhostElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0);
+	GhostElement(const ElementsLocation &, QGraphicsItem * = 0);
 	virtual ~GhostElement();
 	
 	// methods

Modified: trunk/sources/qetgraphicsitem/independenttextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/independenttextitem.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/independenttextitem.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -22,8 +22,8 @@
 	Constructeur
 	@param parent_diagram Le schema auquel est rattache le champ de texte
 */
-IndependentTextItem::IndependentTextItem(Diagram *parent_diagram) :
-	DiagramTextItem(0, parent_diagram)
+IndependentTextItem::IndependentTextItem() :
+	DiagramTextItem(0)
 {}
 
 /**
@@ -31,8 +31,8 @@
 	@param text Le texte affiche par le champ de texte
 	@param parent_diagram Le schema auquel est rattache le champ de texte
 */
-IndependentTextItem::IndependentTextItem(const QString &text, Diagram *parent_diagram) :
-	DiagramTextItem(text, 0, parent_diagram)
+IndependentTextItem::IndependentTextItem(const QString &text) :
+	DiagramTextItem(text, 0)
 {}
 
 /// Destructeur

Modified: trunk/sources/qetgraphicsitem/independenttextitem.h
===================================================================
--- trunk/sources/qetgraphicsitem/independenttextitem.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/independenttextitem.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -28,8 +28,8 @@
 	Q_OBJECT
 	// constructors, destructor
 	public:
-	IndependentTextItem(Diagram * = 0);
-	IndependentTextItem(const QString &, Diagram* = 0);
+	IndependentTextItem();
+	IndependentTextItem(const QString &);
 	virtual ~IndependentTextItem();
 	
 	// attributes

Modified: trunk/sources/qetgraphicsitem/masterelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/masterelement.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/masterelement.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -27,8 +27,8 @@
  * @param s parent diagram
  * @param state int used to know if the creation of element have error
  */
-MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
-	CustomElement(location, qgi, s, state),
+MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
+	CustomElement(location, qgi, state),
 	cri_ (nullptr)
 {
 	link_type_ = Master;

Modified: trunk/sources/qetgraphicsitem/masterelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/masterelement.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/masterelement.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -33,7 +33,7 @@
 	Q_OBJECT
 	
 	public:
-		explicit MasterElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+		explicit MasterElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
 		~MasterElement();
 
 		virtual void linkToElement     (Element *elmt);

Modified: trunk/sources/qetgraphicsitem/reportelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/reportelement.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -21,17 +21,13 @@
 #include "qetproject.h"
 #include "diagram.h"
 
-ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, Diagram *s, int *state) :
-	CustomElement(location, qgi, s, state)
+ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, int *state) :
+	CustomElement(location, qgi, state)
 {
 	if (!texts().isEmpty())
 		texts().first()->setNoEditable();
 	link_type == "next_report"? link_type_=NextReport : link_type_=PreviousReport;
 	link_type == "next_report"? inverse_report=PreviousReport : inverse_report=NextReport;
-	if (s) {
-		label_ = s->defaultReportProperties();
-		connect(s, SIGNAL(reportPropertiesChanged(QString)), this, SLOT(setLabel(QString)));
-	}
 }
 
 ReportElement::~ReportElement() {
@@ -44,22 +40,36 @@
  * @param elmt
  * element to be linked with this
  */
-void ReportElement::linkToElement(Element * elmt) {
-	//ensure elmt isn't already linked
-	bool i=true;
-	if (!this->isFree()){
+void ReportElement::linkToElement(Element * elmt)
+{
+	if (!diagram() && !elmt -> diagram())
+	{
+		qDebug() << "ReportElement : linkToElement : Unable to link this or element to link isn't in a diagram";
+		return;
+	}
+
+		//ensure elmt isn't already linked
+	bool i = true;
+	if (!this -> isFree())
+	{
 		if (connected_elements.first() == elmt) i = false;
 	}
 
-	//ensure elmt is an inverse report of this element
-	if ((elmt->linkType() == inverse_report) && i) {
+		//ensure elmt is an inverse report of this element
+	if ((elmt->linkType() == inverse_report) && i)
+	{
 		unlinkAllElements();
 		connected_elements << elmt;
-		connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
-		connect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
-		connect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
+
+		connect(elmt,                   SIGNAL( xChanged() ),                                       this, SLOT( updateLabel()     ));
+		connect(elmt,                   SIGNAL( yChanged() ),                                       this, SLOT( updateLabel()     ));
+		connect(diagram(),              SIGNAL( reportPropertiesChanged(QString) ),                 this, SLOT( setLabel(QString) ));
+		connect(diagram() -> project(), SIGNAL( projectDiagramsOrderChanged(QETProject*,int,int) ), this, SLOT( updateLabel()     ));
+
+		label_ = diagram() -> defaultReportProperties();
 		updateLabel();
-		elmt->linkToElement(this);
+
+		elmt -> linkToElement(this);
 	}
 }
 

Modified: trunk/sources/qetgraphicsitem/reportelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/reportelement.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -30,7 +30,7 @@
 	Q_OBJECT
 
 	public  :
-	explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+	explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = 0, int * = 0);
 	~ReportElement();
 	virtual void linkToElement(Element *);
 	virtual void unlinkAllElements();

Modified: trunk/sources/qetgraphicsitem/simpleelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/simpleelement.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/simpleelement.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -25,8 +25,8 @@
  * @param s
  * @param state
  */
-SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
-	CustomElement(location, qgi, s, state),
+SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
+	CustomElement(location, qgi, state),
 	m_comment_item (nullptr)
 {
 	link_type_ = Simple;

Modified: trunk/sources/qetgraphicsitem/simpleelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/simpleelement.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/simpleelement.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -32,7 +32,7 @@
 	Q_OBJECT
 
 	public  :
-		explicit SimpleElement(const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+		explicit SimpleElement(const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
 		~SimpleElement();
 
 		virtual void initLink(QETProject *project);

Modified: trunk/sources/qetgraphicsitem/slaveelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/slaveelement.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/slaveelement.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -29,8 +29,8 @@
  * @param s parent diagram
  * @param state int used to know if the creation of element have error
  */
-SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
-	CustomElement(location, qgi, s, state)
+SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
+	CustomElement(location, qgi, state)
 {
 	Xref_item = NULL;
 	link_type_ = Slave;

Modified: trunk/sources/qetgraphicsitem/slaveelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/slaveelement.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/slaveelement.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -24,7 +24,7 @@
 {
 	Q_OBJECT
 	public:
-	explicit SlaveElement (const ElementsLocation &, QGraphicsItem * = 0, Diagram * = 0, int * = 0);
+	explicit SlaveElement (const ElementsLocation &, QGraphicsItem * = 0, int * = 0);
 	~SlaveElement();
 	virtual void linkToElement(Element *elmt);
 	virtual void unlinkAllElements();

Modified: trunk/sources/qetgraphicsitem/terminal.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/terminal.cpp	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/terminal.cpp	2014-12-14 13:06:21 UTC (rev 3547)
@@ -76,8 +76,8 @@
 	@param e   Element auquel cette borne appartient
 	@param s   Scene sur laquelle figure cette borne
 */
-Terminal::Terminal(QPointF pf, Qet::Orientation o, Element *e, Diagram *s) :
-	QGraphicsItem(e, s),
+Terminal::Terminal(QPointF pf, Qet::Orientation o, Element *e) :
+	QGraphicsItem(e),
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {
@@ -92,8 +92,8 @@
 	@param e    Element auquel cette borne appartient
 	@param s    Scene sur laquelle figure cette borne
 */
-Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e, Diagram *s) :
-	QGraphicsItem(e, s),
+Terminal::Terminal(qreal pf_x, qreal pf_y, Qet::Orientation o, Element *e) :
+	QGraphicsItem(e),
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {
@@ -110,8 +110,8 @@
 	@param e   Element auquel cette borne appartient
 	@param s   Scene sur laquelle figure cette borne
 */
-Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bool hiddenName, Element *e, Diagram *s) :
-	QGraphicsItem(e, s),
+Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bool hiddenName, Element *e) :
+	QGraphicsItem(e),
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {

Modified: trunk/sources/qetgraphicsitem/terminal.h
===================================================================
--- trunk/sources/qetgraphicsitem/terminal.h	2014-12-13 14:01:09 UTC (rev 3546)
+++ trunk/sources/qetgraphicsitem/terminal.h	2014-12-14 13:06:21 UTC (rev 3547)
@@ -31,13 +31,13 @@
 	
 	// constructors, destructor
 	public:
-	Terminal(QPointF,      Qet::Orientation, Element * = 0, Diagram * = 0);
-	Terminal(qreal, qreal, Qet::Orientation, Element * = 0, Diagram * = 0);
-	Terminal(QPointF,      Qet::Orientation, QString number, QString name, bool hiddenName, Element * = 0, Diagram * = 0);
-	virtual ~Terminal();
+		Terminal(QPointF,      Qet::Orientation, Element * = 0);
+		Terminal(qreal, qreal, Qet::Orientation, Element * = 0);
+		Terminal(QPointF,      Qet::Orientation, QString number, QString name, bool hiddenName, Element * = 0);
+		virtual ~Terminal();
 	
 	private:
-	Terminal(const Terminal &);
+		Terminal(const Terminal &);
 	
 	// methods
 	public:


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