update folio report when move diagram position

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2692 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-01-01 16:28:19 +00:00
parent b18576895a
commit c58448bf76
8 changed files with 18 additions and 10 deletions

View File

@@ -18,6 +18,7 @@
#include "reportelement.h"
#include "elementtextitem.h"
#include "diagramposition.h"
#include "qetproject.h"
ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qgi, Diagram *s, int *state) :
CustomElement(location, qgi, s, state)
@@ -25,6 +26,10 @@ ReportElement::ReportElement(const ElementsLocation &location, QGraphicsItem *qg
texts().at(0)->setNoEditable();
}
ReportElement::~ReportElement() {
unlinkAllElements();
}
/**
* @brief ReportElement::linkToElement
* Link this element to the other element
@@ -40,9 +45,10 @@ void ReportElement::linkToElement(Element * elmt) {
//ensure elmt is a report
if (elmt->linkType() == Report && i) {
unLinkAllElements();
unlinkAllElements();
connected_elements << elmt;
connect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(updateLabel()));
connect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
updateLabel();
tmp_uuids_link.removeAll(elmt->uuid());
elmt->linkToElement(this);
@@ -53,18 +59,19 @@ void ReportElement::linkToElement(Element * elmt) {
* @brief ReportElement::unLinkAllElements
* Unlink all of the element in the QList connected_elements
*/
void ReportElement::unLinkAllElements(){
void ReportElement::unlinkAllElements(){
if (!isFree()){
QList <Element *> tmp_elmt = connected_elements;
foreach(Element *elmt, connected_elements) {
disconnect(elmt, SIGNAL(positionChange(QPointF)), this, SLOT(updateLabel()));
disconnect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel()));
}
connected_elements.clear();
updateLabel();
foreach(Element *elmt, tmp_elmt){
elmt->unLinkAllElements();
elmt->unlinkAllElements();
}
}
}