[qet] qet/qet: [5579] Bug fix

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


Revision: 5579
Author:   blacksun
Date:     2018-11-10 13:19:30 +0100 (Sat, 10 Nov 2018)
Log Message:
-----------
Bug fix

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/element.cpp
    trunk/sources/qetgraphicsitem/element.h
    trunk/sources/qetgraphicsitem/masterelement.cpp
    trunk/sources/qetgraphicsitem/reportelement.cpp
    trunk/sources/qetgraphicsitem/simpleelement.cpp
    trunk/sources/qetgraphicsitem/slaveelement.cpp
    trunk/sources/qetgraphicsitem/terminalelement.cpp

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2018-11-10 10:51:36 UTC (rev 5578)
+++ trunk/sources/qetgraphicsitem/element.cpp	2018-11-10 12:19:30 UTC (rev 5579)
@@ -1,5 +1,5 @@
 /*
-	Copyright 2006-2017 The QElectroTech Team
+	Copyright 2006-2018 The QElectroTech Team
 	This file is part of QElectroTech.
 	
 	QElectroTech is free software: you can redistribute it and/or modify
@@ -69,8 +69,9 @@
  * @param parent, parent graphics item
  * @param state, state of the instanciation
  */
-Element::Element(const ElementsLocation &location, QGraphicsItem *parent, int *state) :
+Element::Element(const ElementsLocation &location, QGraphicsItem *parent, int *state, kind link_type) :
 	QetGraphicsItem(parent),
+	m_link_type (link_type),
 	m_location (location)
 {
 	if(! (location.isElement() && location.exist()))
@@ -94,7 +95,6 @@
 	}
 	
 	setPrefix(autonum::elementPrefixForLocation(location));
-	m_link_type = Simple;
 	m_uuid = QUuid::createUuid();
 	setZValue(10);
 	setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2018-11-10 10:51:36 UTC (rev 5578)
+++ trunk/sources/qetgraphicsitem/element.h	2018-11-10 12:19:30 UTC (rev 5579)
@@ -1,5 +1,5 @@
 /*
-	Copyright 2006-2017 The QElectroTech Team
+	Copyright 2006-2018 The QElectroTech Team
 	This file is part of QElectroTech.
 	
 	QElectroTech is free software: you can redistribute it and/or modify
@@ -42,10 +42,20 @@
 	friend class DiagramEventAddElement;
 	
 	Q_OBJECT
-	
-		// constructors, destructor
 	public:
-		Element(const ElementsLocation &location, QGraphicsItem * = nullptr, int *state = nullptr);
+			/**
+			 * @brief The kind enum
+			 * Used to know the kind of this element (master, slave, report ect...)
+			 */
+		enum kind {Simple = 1,
+				   NextReport = 2,
+				   PreviousReport = 4,
+				   AllReport = 6,
+				   Master = 8,
+				   Slave = 16,
+				   Terminale = 32};
+
+		Element(const ElementsLocation &location, QGraphicsItem * = nullptr, int *state = nullptr, Element::kind link_type = Element::Simple);
 		~Element() override;
 	private:
 		Element(const Element &);
@@ -58,18 +68,6 @@
 			 */
 		enum { Type = UserType + 1000 };
 		int type() const override { return Type; }
-
-			/**
-			 * @brief The kind enum
-			 * Used to know the kind of this element (master, slave, report ect...)
-			 */
-		enum kind {Simple = 1,
-				   NextReport = 2,
-				   PreviousReport = 4,
-				   AllReport = 6,
-				   Master = 8,
-				   Slave = 16,
-				   Terminale = 32};
 		
 	signals:
 		void linkedElementChanged(); //This signal is emited when the linked elements with this element change
@@ -173,7 +171,7 @@
 		QList <Element *> connected_elements;
 		QList <QUuid>     tmp_uuids_link;
 		QUuid             m_uuid;
-		kind              m_link_type;
+		kind              m_link_type = Element::Simple;
 		
 			//ATTRIBUTES related to informations
 		DiagramContext m_element_informations, m_kind_informations;

Modified: trunk/sources/qetgraphicsitem/masterelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/masterelement.cpp	2018-11-10 10:51:36 UTC (rev 5578)
+++ trunk/sources/qetgraphicsitem/masterelement.cpp	2018-11-10 12:19:30 UTC (rev 5579)
@@ -1,5 +1,5 @@
 /*
-	Copyright 2006-2017 The QElectroTech Team
+	Copyright 2006-2018 The QElectroTech Team
 	This file is part of QElectroTech.
 
 	QElectroTech is free software: you can redistribute it and/or modify
@@ -30,10 +30,8 @@
  * @param state int used to know if the creation of element have error
  */
 MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
-	Element(location, qgi, state)
-{
-	m_link_type = Element::Master;
-}
+	Element(location, qgi, state, Element::Master)
+{}
 
 /**
  * @brief MasterElement::~MasterElement

Modified: trunk/sources/qetgraphicsitem/reportelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.cpp	2018-11-10 10:51:36 UTC (rev 5578)
+++ trunk/sources/qetgraphicsitem/reportelement.cpp	2018-11-10 12:19:30 UTC (rev 5579)
@@ -1,5 +1,5 @@
 /*
-	Copyright 2006-2017 The QElectroTech Team
+	Copyright 2006-2018 The QElectroTech Team
 	This file is part of QElectroTech.
 
 	QElectroTech is free software: you can redistribute it and/or modify
@@ -24,11 +24,10 @@
 #include "dynamicelementtextitem.h"
 
 ReportElement::ReportElement(const ElementsLocation &location, const QString& link_type,QGraphicsItem *qgi, int *state) :
-	Element(location, qgi, state)
-{
-	link_type == "next_report"? m_link_type=NextReport : m_link_type=PreviousReport;
-	link_type == "next_report"? m_inverse_report=PreviousReport : m_inverse_report=NextReport;
-}
+	Element(location, qgi, state,
+			link_type == "next_report"? Element::NextReport : Element::PreviousReport),
+	m_inverse_report(link_type == "next_report"? Element::PreviousReport : Element::NextReport)
+{}
 
 /**
  * @brief ReportElement::~ReportElement

Modified: trunk/sources/qetgraphicsitem/simpleelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/simpleelement.cpp	2018-11-10 10:51:36 UTC (rev 5578)
+++ trunk/sources/qetgraphicsitem/simpleelement.cpp	2018-11-10 12:19:30 UTC (rev 5579)
@@ -1,5 +1,5 @@
 /*
-	Copyright 2006-2017 The QElectroTech Team
+	Copyright 2006-2018 The QElectroTech Team
 	This file is part of QElectroTech.
 
 	QElectroTech is free software: you can redistribute it and/or modify
@@ -26,10 +26,8 @@
  * @param state
  */
 SimpleElement::SimpleElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
-	Element(location, qgi, state)
-{
-	m_link_type = Simple;
-}
+	Element(location, qgi, state, Element::Simple)
+{}
 
 /**
  * @brief SimpleElement::~SimpleElement

Modified: trunk/sources/qetgraphicsitem/slaveelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/slaveelement.cpp	2018-11-10 10:51:36 UTC (rev 5578)
+++ trunk/sources/qetgraphicsitem/slaveelement.cpp	2018-11-10 12:19:30 UTC (rev 5579)
@@ -1,5 +1,5 @@
 /*
-	Copyright 2006-2017 The QElectroTech Team
+	Copyright 2006-2018 The QElectroTech Team
 	This file is part of QElectroTech.
 
 	QElectroTech is free software: you can redistribute it and/or modify
@@ -30,10 +30,9 @@
  * @param state int used to know if the creation of element have error
  */
 SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
-	Element(location, qgi, state)
+	Element(location, qgi, state, Element::Slave)
 {
 	m_xref_item = nullptr;
-	m_link_type = Slave;
 }
 
 /**

Modified: trunk/sources/qetgraphicsitem/terminalelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/terminalelement.cpp	2018-11-10 10:51:36 UTC (rev 5578)
+++ trunk/sources/qetgraphicsitem/terminalelement.cpp	2018-11-10 12:19:30 UTC (rev 5579)
@@ -1,5 +1,5 @@
 /*
-	Copyright 2006-2017 The QElectroTech Team
+	Copyright 2006-2018 The QElectroTech Team
 	This file is part of QElectroTech.
 
 	QElectroTech is free software: you can redistribute it and/or modify
@@ -26,8 +26,8 @@
  * @param state int used to know if the creation of element have error
  */
 TerminalElement::TerminalElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
-	Element(location, qgi, state)
-{m_link_type = Terminale;}
+	Element(location, qgi, state, Element::Terminale)
+{}
 
 TerminalElement::~TerminalElement() {}
 


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