[qet] [2686] revert some change in comit 2675:

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


Revision: 2686
Author:   blacksun
Date:     2013-12-31 13:03:36 +0100 (Tue, 31 Dec 2013)
Log Message:
-----------
revert some change in comit 2675:
Qt use enum for use flags: Qt is a good exemple to make code

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/qetgraphicsitem/element.h
    trunk/sources/qetgraphicsitem/ghostelement.h
    trunk/sources/qetgraphicsitem/reportelement.cpp
    trunk/sources/qetgraphicsitem/simpleelement.cpp
    trunk/sources/ui/folioreportproperties.cpp

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2013-12-31 08:51:18 UTC (rev 2685)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2013-12-31 12:03:36 UTC (rev 2686)
@@ -549,7 +549,7 @@
 	QFont used_font = QETApp::diagramTextsFont(size);
 	QFontMetrics qfm(used_font);
 	QColor text_color = (e.attribute("color") != "white"? Qt::black : Qt::white);
-
+	
 	// instancie un QTextDocument (comme la classe QGraphicsTextItem) pour
 	// generer le rendu graphique du texte
 	QTextDocument text_document;
@@ -742,7 +742,7 @@
 	// attributs par defaut
 	pen.setJoinStyle(Qt::BevelJoin);
 	pen.setCapStyle(Qt::SquareCap);
-
+	
 	// recupere la liste des couples style / valeur
 	QStringList styles = e.attribute("style").split(";", QString::SkipEmptyParts);
 	

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2013-12-31 08:51:18 UTC (rev 2685)
+++ trunk/sources/qetgraphicsitem/element.h	2013-12-31 12:03:36 UTC (rev 2686)
@@ -23,13 +23,6 @@
 class Diagram;
 class ElementTextItem;
 
-// this define is use to know the kind of element and
-// to use flag for element provider class
-#define SIMPLE 1
-#define REPORT 2
-#define MASTER 4
-#define SLAVE 8
-#define BORNIER 16
 
 /**
 	This is the base class for electrical elements.
@@ -49,6 +42,15 @@
 	// 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 {Simple = 1,
+		  Report = 2,
+		  Master = 4,
+		  SlaveNO = 8,
+		  SlaveNC = 16,
+		  AllSlave = 24,
+		  Bornier = 32};
 	
 	protected:
 	QList <Element *> connected_elements;

Modified: trunk/sources/qetgraphicsitem/ghostelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/ghostelement.h	2013-12-31 08:51:18 UTC (rev 2685)
+++ trunk/sources/qetgraphicsitem/ghostelement.h	2013-12-31 12:03:36 UTC (rev 2686)
@@ -43,7 +43,7 @@
 	// methods
 	public:
 	virtual bool fromXml(QDomElement &, QHash<int, Terminal *> &, bool = false);
-	virtual int linkType() const {return SIMPLE;}
+	virtual int linkType() const {return Simple;}
 	
 	protected:
 	QRectF minimalBoundingRect() const;

Modified: trunk/sources/qetgraphicsitem/reportelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/reportelement.cpp	2013-12-31 08:51:18 UTC (rev 2685)
+++ trunk/sources/qetgraphicsitem/reportelement.cpp	2013-12-31 12:03:36 UTC (rev 2686)
@@ -39,7 +39,7 @@
 	}
 
 	//ensure elmt is a report
-	if (elmt->linkType() == REPORT && i) {
+	if (elmt->linkType() == Report && i) {
 		unLinkAllElements();
 		connected_elements << elmt;
 		connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(updateLabel()));
@@ -73,7 +73,7 @@
  * @return the kind of link type
  */
 int ReportElement::linkType() const {
-	return REPORT;
+	return Report;
 }
 
 /**

Modified: trunk/sources/qetgraphicsitem/simpleelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/simpleelement.cpp	2013-12-31 08:51:18 UTC (rev 2685)
+++ trunk/sources/qetgraphicsitem/simpleelement.cpp	2013-12-31 12:03:36 UTC (rev 2686)
@@ -22,5 +22,5 @@
 {}
 
 int SimpleElement::linkType() const {
-	return SIMPLE;
+	return Simple;
 }

Modified: trunk/sources/ui/folioreportproperties.cpp
===================================================================
--- trunk/sources/ui/folioreportproperties.cpp	2013-12-31 08:51:18 UTC (rev 2685)
+++ trunk/sources/ui/folioreportproperties.cpp	2013-12-31 12:03:36 UTC (rev 2686)
@@ -37,7 +37,7 @@
  */
 void FolioReportProperties::BuildRadioList() {
 	ElementProvider ep(element_->diagram()->project(), element_->diagram());
-	QList <Element *> elmt_list = ep.FreeElement(REPORT);
+	QList <Element *> elmt_list = ep.FreeElement(Element::Report);
 
 	foreach (Element *elmt, elmt_list) {
 		if (elmt != element_) {


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