From 1252288ad1c9a9a7f7bfdcb5ab8aa02cb9eeacf9 Mon Sep 17 00:00:00 2001 From: blacksun Date: Sat, 1 Nov 2014 11:09:58 +0000 Subject: [PATCH] Bug fix: Xref for slave element will be updated when diagram order change in project. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3428 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetgraphicsitem/slaveelement.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sources/qetgraphicsitem/slaveelement.cpp b/sources/qetgraphicsitem/slaveelement.cpp index 8c7bc1536..2acb248f1 100644 --- a/sources/qetgraphicsitem/slaveelement.cpp +++ b/sources/qetgraphicsitem/slaveelement.cpp @@ -55,11 +55,14 @@ void SlaveElement::linkToElement(Element *elmt) { 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 @@ void SlaveElement::unlinkElement(Element *elmt) { //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); } }