[qet] [3428] Bug fix: Xref for slave element will be updated when diagram order change in project.

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


Revision: 3428
Author:   blacksun
Date:     2014-11-01 12:09:58 +0100 (Sat, 01 Nov 2014)
Log Message:
-----------
Bug fix: Xref for slave element will be updated when diagram order change in project.

Modified Paths:
--------------
    trunk/sources/qetgraphicsitem/slaveelement.cpp

Modified: trunk/sources/qetgraphicsitem/slaveelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/slaveelement.cpp	2014-11-01 00:03:46 UTC (rev 3427)
+++ trunk/sources/qetgraphicsitem/slaveelement.cpp	2014-11-01 11:09:58 UTC (rev 3428)
@@ -55,11 +55,14 @@
 	if (elmt->linkType() == Master && !connected_elements.contains(elmt)) {
 		if(!isFree()) unlinkAllElements();
 		connected_elements << elmt;
+
+		connect(elmt,                 SIGNAL(xChanged()),                                       this, SLOT(updateLabel()));
+		connect(elmt,                 SIGNAL(yChanged()),                                       this, SLOT(updateLabel()));
+		connect(elmt,                 SIGNAL(elementInfoChange(DiagramContext)),                this, SLOT(updateLabel()));
+		connect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
+
 		updateLabel();
-		connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
-		connect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
-		connect(elmt, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
-		elmt->linkToElement(this);
+		elmt -> linkToElement(this);
 	}
 }
 
@@ -85,12 +88,16 @@
 	//Ensure elmt is linked to this element
 	if (connected_elements.contains(elmt)) {
 		connected_elements.removeOne(elmt);
-		disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
-		disconnect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
-		disconnect(elmt, SIGNAL(elementInfoChange(DiagramContext)), this, SLOT(updateLabel()));
+
+		disconnect(elmt,                 SIGNAL(xChanged()),                                       this, SLOT(updateLabel()));
+		disconnect(elmt,                 SIGNAL(yChanged()),                                       this, SLOT(updateLabel()));
+		disconnect(elmt,                 SIGNAL(elementInfoChange(DiagramContext)),                this, SLOT(updateLabel()));
+		disconnect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
+
 		delete Xref_item; Xref_item = NULL;
+
 		updateLabel();
-		elmt->unlinkElement(this);
+		elmt -> unlinkElement(this);
 	}
 }
 


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