[qet] [2959] cross ref item: don't show postion of element 'power'.

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


Revision: 2959
Author:   blacksun
Date:     2014-04-02 19:36:40 +0200 (Wed, 02 Apr 2014)
Log Message:
-----------
cross ref item: don't show postion of element 'power'.

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/crossrefitem.cpp
    trunk/sources/qetgraphicsitem/masterelement.cpp

Modified: trunk/sources/qetgraphicsitem/crossrefitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/crossrefitem.cpp	2014-04-02 17:20:35 UTC (rev 2958)
+++ trunk/sources/qetgraphicsitem/crossrefitem.cpp	2014-04-02 17:36:40 UTC (rev 2959)
@@ -88,8 +88,8 @@
 
 	//draw the cross
 	QRectF br = boundingRect();
-	qp.drawLine(br.width()/2, 0, br.width()/2, br.height() - text_rect_.height());	//vertical line
-	qp.drawLine(br.width()/2-25, header, br.width()/2+25, header);					//horizontal line
+	qp.drawLine(br.width()/2, 0, br.width()/2, br.height() - text_rect_.height());			//vertical line
+	qp.drawLine(br.width()/2-(crossWidth/2), header, br.width()/2+(crossWidth/2), header);	//horizontal line
 
 	//draw the symbolic NO
 	qreal xoffset = br.width()/2 - 25;
@@ -277,6 +277,7 @@
 
 	//find each no and nc of connected element to element_
 	foreach (Element *elmt, element_->linkedElements()) {
+		if (elmt->kindInformations()["type"].toString() == "power") continue;
 		QString state = elmt->kindInformations()["state"].toString();
 		if (state == "NO")		NO_list << elmt;
 		else if (state == "NC") NC_list << elmt;

Modified: trunk/sources/qetgraphicsitem/masterelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/masterelement.cpp	2014-04-02 17:20:35 UTC (rev 2958)
+++ trunk/sources/qetgraphicsitem/masterelement.cpp	2014-04-02 17:36:40 UTC (rev 2959)
@@ -53,10 +53,12 @@
 	if (elmt->linkType() == Slave && !connected_elements.contains(elmt)) {
 		connected_elements << elmt;
 		elmt->linkToElement(this);
-		//create cross ref item if not yet
-		if (!cri_) cri_ = new CrossRefItem(this, this);
-		connect(elmt, SIGNAL(positionChange(QPointF)), cri_, SLOT(updateLabel()));
-		cri_->updateLabel();
+
+		if (elmt->kindInformations()["type"].toString() != "power") {
+			if (!cri_) cri_ = new CrossRefItem(this, this); //create cross ref item if not yet
+			connect(elmt, SIGNAL(positionChange(QPointF)), cri_, SLOT(updateLabel()));
+			cri_->updateLabel();
+		}
 	}
 }
 
@@ -85,7 +87,12 @@
 		elmt->unlinkElement(this);
 		//update the graphics cross ref
 		disconnect(elmt, SIGNAL(positionChange(QPointF)), cri_, SLOT(updateLabel()));
-		if (isFree()) {
+
+		bool delete_cri = true;
+		foreach(Element *elmt, linkedElements())
+			if (elmt->kindInformations()["type"].toString() != "power") delete_cri = false;
+
+		if (delete_cri) {
 			delete cri_;
 			cri_ = 0;
 		}


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