diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 20ebabb09..5b80858ed 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -1694,15 +1694,11 @@ QETProject *Diagram::project() const { */ void Diagram::setProject(QETProject *project) { - if (m_project == project) return; - - if (m_project) - disconnect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged())); + if (m_project == project) + return; m_project = project; setParent (project); - - connect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged())); } /** diff --git a/sources/diagram.h b/sources/diagram.h index 1bf4f4c34..a840f2ff9 100644 --- a/sources/diagram.h +++ b/sources/diagram.h @@ -129,18 +129,14 @@ class Diagram : public QGraphicsScene public: void setEventInterface (DiagramEventInterface *event_interface); - - //methods related to xref properties - QString defaultReportProperties () const {return m_project -> defaultReportProperties();} - XRefProperties defaultXRefProperties (const QString &str) const {return m_project -> defaultXRefProperties(str);} - - //methods related to autonum + + //methods related to autonum QString conductorsAutonumName() const; void setConductorsAutonumName(const QString &name); static bool clipboardMayContainDiagram(); - // methods related to parent project + // methods related to parent project QETProject *project() const; void setProject(QETProject *); int folioIndex() const; @@ -148,88 +144,88 @@ class Diagram : public QGraphicsScene void showMe() {emit showDiagram(this);} bool isReadOnly() const; - // methods related to conductor creation - void setConductor(bool); - void setConductorStart (QPointF); - void setConductorStop(QPointF); - QList < QSet > potentials(); + // methods related to conductor creation + void setConductor(bool); + void setConductorStart (QPointF); + void setConductorStop(QPointF); + QList < QSet > potentials(); - // methods related to XML import/export - QDomDocument toXml(bool = true); - bool initFromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = 0); - bool fromXml(QDomDocument &, QPointF = QPointF(), bool = true, DiagramContent * = 0); - bool fromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = 0); - void write(); - void write(const QDomElement &); - bool wasWritten() const; - QDomElement writeXml(QDomDocument &) const; - void folioSequentialsToXml(QHash*, QDomElement *, QString, QString, QDomDocument *); - void folioSequentialsFromXml(const QDomElement&, QHash*, QString, QString, QString, QString); - - void refreshContents(); - - // methods related to graphics items addition/removal on the diagram - virtual void addItem (QGraphicsItem *item); - virtual void removeItem (QGraphicsItem *item); + // methods related to XML import/export + QDomDocument toXml(bool = true); + bool initFromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = 0); + bool fromXml(QDomDocument &, QPointF = QPointF(), bool = true, DiagramContent * = 0); + bool fromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = 0); + void write(); + void write(const QDomElement &); + bool wasWritten() const; + QDomElement writeXml(QDomDocument &) const; + void folioSequentialsToXml(QHash*, QDomElement *, QString, QString, QDomDocument *); + void folioSequentialsFromXml(const QDomElement&, QHash*, QString, QString, QString, QString); - // methods related to graphics options - ExportProperties applyProperties(const ExportProperties &); - void setDisplayGrid(bool); - bool displayGrid(); - void setUseBorder(bool); - bool useBorder(); - void setBorderOptions(BorderOptions); - BorderOptions borderOptions(); - DiagramPosition convertPosition(const QPointF &); - static QPointF snapToGrid(const QPointF &p); + void refreshContents(); - bool drawTerminals() const; - void setDrawTerminals(bool); - bool drawColoredConductors() const; - void setDrawColoredConductors(bool); - - QString title() const; - bool toPaintDevice(QPaintDevice &, int = -1, int = -1, Qt::AspectRatioMode = Qt::KeepAspectRatio); - QSize imageSize() const; + // methods related to graphics items addition/removal on the diagram + virtual void addItem (QGraphicsItem *item); + virtual void removeItem (QGraphicsItem *item); - bool isEmpty() const; + // methods related to graphics options + ExportProperties applyProperties(const ExportProperties &); + void setDisplayGrid(bool); + bool displayGrid(); + void setUseBorder(bool); + bool useBorder(); + void setBorderOptions(BorderOptions); + BorderOptions borderOptions(); + DiagramPosition convertPosition(const QPointF &); + static QPointF snapToGrid(const QPointF &p); - QList customElements() const; - QList elements() const; - QList conductors() const; - QSet selectedTexts() const; - QSet selectedConductorTexts() const; - QSet selectedElementTexts() const; - QSet selectedConductors() const; - DiagramContent content() const; - DiagramContent selectedContent(); - bool canRotateSelection() const; - int beginMoveElements(QGraphicsItem * = 0); - void continueMoveElements(const QPointF &); - void endMoveElements(); - int beginMoveElementTexts(QGraphicsItem * = 0); - void continueMoveElementTexts(const QPointF &); - void endMoveElementTexts(); - bool usesElement(const ElementsLocation &); - bool usesTitleBlockTemplate(const QString &); + bool drawTerminals() const; + void setDrawTerminals(bool); + bool drawColoredConductors() const; + void setDrawColoredConductors(bool); - QUndoStack &undoStack(); - QGIManager &qgiManager(); + QString title() const; + bool toPaintDevice(QPaintDevice &, int = -1, int = -1, Qt::AspectRatioMode = Qt::KeepAspectRatio); + QSize imageSize() const; + + bool isEmpty() const; - //methods related to element label Update Policy - void freezeElements(bool freeze); - void unfreezeElements(); - void setFreezeNewElements(bool); - bool freezeNewElements(); - - //methods related to conductor label Update Policy - void freezeConductors(bool freeze); - void setFreezeNewConductors(bool); - bool freezeNewConductors(); - - //methods related to insertion and loading of folio sequential - void insertFolioSeqHash (QHash *hash, QString title, QString seq, NumerotationContext *nc); - void loadFolioSeqHash (QHash *hash, QString title, QString seq, NumerotationContext *nc); + QList customElements() const; + QList elements() const; + QList conductors() const; + QSet selectedTexts() const; + QSet selectedConductorTexts() const; + QSet selectedElementTexts() const; + QSet selectedConductors() const; + DiagramContent content() const; + DiagramContent selectedContent(); + bool canRotateSelection() const; + int beginMoveElements(QGraphicsItem * = 0); + void continueMoveElements(const QPointF &); + void endMoveElements(); + int beginMoveElementTexts(QGraphicsItem * = 0); + void continueMoveElementTexts(const QPointF &); + void endMoveElementTexts(); + bool usesElement(const ElementsLocation &); + bool usesTitleBlockTemplate(const QString &); + + QUndoStack &undoStack(); + QGIManager &qgiManager(); + + //methods related to element label Update Policy + void freezeElements(bool freeze); + void unfreezeElements(); + void setFreezeNewElements(bool); + bool freezeNewElements(); + + //methods related to conductor label Update Policy + void freezeConductors(bool freeze); + void setFreezeNewConductors(bool); + bool freezeNewConductors(); + + //methods related to insertion and loading of folio sequential + void insertFolioSeqHash (QHash *hash, QString title, QString seq, NumerotationContext *nc); + void loadFolioSeqHash (QHash *hash, QString title, QString seq, NumerotationContext *nc); public slots: @@ -243,7 +239,7 @@ class Diagram : public QGraphicsScene void loadElmtFolioSeq(); void loadCndFolioSeq(); - // methods related to graphics items selection + // methods related to graphics items selection void selectAll(); void deselectAll(); void invertSelection(); @@ -255,7 +251,6 @@ class Diagram : public QGraphicsScene void diagramTitleChanged(Diagram *, const QString &); void findElementRequired(const ElementsLocation &); /// Signal emitted when users wish to locate an element from the diagram within elements collection void editElementRequired(const ElementsLocation &); /// Signal emitted when users wish to edit an element from the diagram - void XRefPropertiesChanged(); void diagramActivated(); }; Q_DECLARE_METATYPE(Diagram *) diff --git a/sources/qetgraphicsitem/commentitem.cpp b/sources/qetgraphicsitem/commentitem.cpp index 98cb53753..ee3d6f45b 100644 --- a/sources/qetgraphicsitem/commentitem.cpp +++ b/sources/qetgraphicsitem/commentitem.cpp @@ -54,11 +54,13 @@ QRectF CommentItem::boundingRect() const { * @brief CommentItem::autoPos * Adjust the position of this item. */ -void CommentItem::autoPos() { +void CommentItem::autoPos() +{ if (m_text_parent) centerToParentBottom(this); - else { - XRefProperties xrp = m_element->diagram()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); + else + { + XRefProperties xrp = m_element->diagram()->project()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); centerToBottomDiagram(this, m_element, xrp.offset()); } } diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index 135a57bd4..68274f833 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -45,15 +45,17 @@ CrossRefItem::CrossRefItem(Element *elmt) : { Q_ASSERT_X(elmt->diagram(), "CrossRefItem constructor", "Parent element is not in a diagram"); - m_properties = elmt->diagram()->defaultXRefProperties(elmt->kindInformations()["type"].toString()); + m_properties = elmt->diagram()->project()->defaultXRefProperties(elmt->kindInformations()["type"].toString()); setAcceptHoverEvents(true); - connect(elmt -> diagram() -> project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel())); - connect(elmt -> diagram() -> project(), SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel())); - connect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateProperties())); + QETProject *project = elmt->diagram()->project(); + connect(project, &QETProject::projectDiagramsOrderChanged, this, &CrossRefItem::updateLabel); + connect(project, &QETProject::diagramRemoved, this, &CrossRefItem::updateLabel); + connect(project, &QETProject::XRefPropertiesChanged, this, &CrossRefItem::updateProperties); //set specific behavior related to the parent item. - if(m_properties.snapTo() == XRefProperties::Bottom) { + if(m_properties.snapTo() == XRefProperties::Bottom) + { connect(elmt, SIGNAL(yChanged()), this, SLOT(autoPos())); connect(elmt, SIGNAL(rotationChanged()), this, SLOT(autoPos())); } else { @@ -92,7 +94,7 @@ QPainterPath CrossRefItem::shape() const{ */ QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_prefix) const { - XRefProperties xrp = m_element->diagram()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); + XRefProperties xrp = m_element->diagram()->project()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); QString formula = xrp.masterLabel(); autonum::sequentialNumbers seq; QString txt = autonum::AssignVariables::formulaToLabel(formula, seq, elmt->diagram(), elmt); @@ -110,16 +112,22 @@ QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_p * @brief CrossRefItem::updateProperties * update the curent properties */ -void CrossRefItem::updateProperties() { - XRefProperties xrp = m_element->diagram()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); +void CrossRefItem::updateProperties() +{ + XRefProperties xrp = m_element->diagram()->project()->defaultXRefProperties(m_element->kindInformations()["type"].toString()); - if (m_properties != xrp) { - if (m_properties.snapTo() != xrp.snapTo()) { - if (xrp.snapTo() == XRefProperties::Bottom) { + if (m_properties != xrp) + { + if (m_properties.snapTo() != xrp.snapTo()) + { + if (xrp.snapTo() == XRefProperties::Bottom) + { setParentItem(m_element); connect(m_element, SIGNAL(yChanged()), this, SLOT(autoPos())); connect(m_element, SIGNAL(rotationChanged()), this, SLOT(autoPos())); - } else { + } + else + { setTextParent(); disconnect(m_element, SIGNAL(yChanged()), this, SLOT(autoPos())); disconnect(m_element, SIGNAL(rotationChanged()), this, SLOT(autoPos())); diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index e68eaab5b..4549d4227 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -877,7 +877,10 @@ void Element::setUpConnectionForFormula(QString old_formula, QString new_formula //Because the variable %F is a reference to another text which can contain variables, //we must to replace %F by the real text, to check if the real text contain the variable %id if (diagram() && old_formula.contains("%F")) - old_formula.replace("%F", diagram()->border_and_titleblock.folio()); + { + disconnect(&diagram()->border_and_titleblock, &BorderTitleBlock::titleBlockFolioChanged, this, &Element::updateLabel); + old_formula.replace("%F", m_F_str); + } if (diagram() && (old_formula.contains("%f") || old_formula.contains("%id"))) disconnect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Element::updateLabel); @@ -891,7 +894,11 @@ void Element::setUpConnectionForFormula(QString old_formula, QString new_formula return; if (diagram() && new_formula.contains("%F")) - new_formula.replace("%F", diagram()->border_and_titleblock.folio()); + { + m_F_str = diagram()->border_and_titleblock.folio(); + new_formula.replace("%F", m_F_str); + connect(&diagram()->border_and_titleblock, &BorderTitleBlock::titleBlockFolioChanged, this, &Element::updateLabel); + } if (diagram() && (new_formula.contains("%f") || new_formula.contains("%id"))) connect(diagram()->project(), &QETProject::projectDiagramsOrderChanged, this, &Element::updateLabel); diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index 501c77eca..910ec34dd 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -149,13 +149,14 @@ class Element : public QetGraphicsItem void freezeNewAddedElement(); protected: - void setUpConnectionForFormula(QString old_formula, QString new_formula); + virtual void setUpConnectionForFormula(QString old_formula, QString new_formula); //ATTRIBUTES protected: DiagramContext m_element_informations, kind_informations_; autonum::sequentialNumbers m_autoNum_seq; bool m_freeze_label = false; + QString m_F_str; /** Draw this element diff --git a/sources/qetgraphicsitem/masterelement.cpp b/sources/qetgraphicsitem/masterelement.cpp index 34f707c39..e1de49e94 100644 --- a/sources/qetgraphicsitem/masterelement.cpp +++ b/sources/qetgraphicsitem/masterelement.cpp @@ -65,6 +65,7 @@ void MasterElement::linkToElement(Element *elmt) connect(elmt, SIGNAL(xChanged()), m_Xref_item, SLOT(updateLabel())); connect(elmt, SIGNAL(yChanged()), m_Xref_item, SLOT(updateLabel())); connect(elmt, SIGNAL(updateLabel()), m_Xref_item, SLOT(updateLabel())); + connect(&elmt->diagram()->border_and_titleblock, &BorderTitleBlock::titleBlockFolioChanged, m_Xref_item, &CrossRefItem::updateLabel); m_Xref_item -> updateLabel(); emit linkedElementChanged(); } @@ -103,6 +104,7 @@ void MasterElement::unlinkElement(Element *elmt) disconnect(elmt, SIGNAL(xChanged()), m_Xref_item, SLOT(updateLabel())); disconnect(elmt, SIGNAL(yChanged()), m_Xref_item, SLOT(updateLabel())); disconnect(elmt, SIGNAL(updateLabel()), m_Xref_item, SLOT(updateLabel())); + disconnect(&elmt->diagram()->border_and_titleblock, &BorderTitleBlock::titleBlockFolioChanged, m_Xref_item, &CrossRefItem::updateLabel); m_Xref_item -> updateLabel(); aboutDeleteXref(); diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp index de4d11c32..a4b221551 100644 --- a/sources/qetgraphicsitem/reportelement.cpp +++ b/sources/qetgraphicsitem/reportelement.cpp @@ -88,25 +88,22 @@ void ReportElement::linkToElement(Element * elmt) { unlinkAllElements(); connected_elements << elmt; - - connect(elmt, SIGNAL( xChanged() ), this, SLOT( updateLabel() )); - connect(elmt, SIGNAL( yChanged() ), this, SLOT( updateLabel() )); + m_formula = diagram()->project()->defaultReportProperties(); + setConnectionForFormula(m_formula); connect(diagram()->project(), &QETProject::reportPropertiesChanged, this, &ReportElement::reportPropertiesChange); - connect(diagram() -> project(), SIGNAL( projectDiagramsOrderChanged(QETProject*,int,int) ), this, SLOT( updateLabel() )); + if (elmt->terminals().size()) { connect(elmt->terminals().first(), &Terminal::conductorWasAdded, this, &ReportElement::conductorWasAdded); connect(elmt->terminals().first(), &Terminal::conductorWasRemoved, this, &ReportElement::conductorWasRemoved); } - - m_label = diagram() -> defaultReportProperties(); - + if (!m_watched_conductor && elmt->conductors().size()) conductorWasAdded(elmt->conductors().first()); else updateLabel(); - elmt -> linkToElement(this); + elmt->linkToElement(this); emit linkedElementChanged(); } @@ -118,16 +115,16 @@ void ReportElement::linkToElement(Element * elmt) */ void ReportElement::unlinkAllElements() { - if (isFree()) return; + if (isFree()) + return; - QList tmp_elmt = connected_elements; + const QList tmp_elmt = connected_elements; - foreach(Element *elmt, connected_elements) + for (Element *elmt : tmp_elmt) { - disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel())); - disconnect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel())); + removeConnectionForFormula(m_formula); disconnect(diagram()->project(), &QETProject::reportPropertiesChanged, this, &ReportElement::reportPropertiesChange); - disconnect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel())); + if (elmt->terminals().size()) { disconnect(elmt->terminals().first(), &Terminal::conductorWasAdded, this, &ReportElement::conductorWasAdded); @@ -140,11 +137,12 @@ void ReportElement::unlinkAllElements() } updateLabel(); - foreach(Element *elmt, tmp_elmt) + for(Element *elmt : tmp_elmt) { elmt -> setHighlighted(false); elmt -> unlinkAllElements(); } + emit linkedElementChanged(); } /** @@ -198,12 +196,15 @@ void ReportElement::conductorWasRemoved(Conductor *conductor) } /** - * @brief ReportElement::setLabel - * Set new label and call updatelabel - * @param label new label + * @brief ReportElement::setFormula + * Set new Formula and call updatelabel + * @param formula : the new formula */ -void ReportElement::setLabel(QString label) { - m_label = label; +void ReportElement::setFormula(QString formula) +{ + removeConnectionForFormula(m_formula); + m_formula = formula; + setConnectionForFormula(m_formula); updateLabel(); } @@ -219,7 +220,7 @@ void ReportElement::updateLabel() if (!connected_elements.isEmpty()) { Element *elmt = connected_elements.at(0); - QString label = m_label; + QString label = m_formula; label = autonum::AssignVariables::formulaToLabel(label, elmt->rSequenceStruct(), elmt->diagram(), elmt); m_text_field -> setPlainText(label); } @@ -233,5 +234,73 @@ void ReportElement::updateLabel() void ReportElement::reportPropertiesChange(const QString &old_str, const QString &new_str) { Q_UNUSED(old_str); - setLabel(new_str); + setFormula(new_str); +} + +/** + * @brief ReportElement::setConnectionForFormula + * Set up the required connection for the formula @str. + * @param str + */ +void ReportElement::setConnectionForFormula(const QString &str) +{ + if (connected_elements.isEmpty() || str.isEmpty()) + return; + + QString string = str; + Element *other_elmt = connected_elements.first(); + Diagram *other_diagram = other_elmt->diagram(); + + //Because the variable %F is a reference to another text which can contain variables, + //we must to replace %F by the real text, to check if the real text contain the variable %id + if (other_diagram && string.contains("%F")) + { + m_F_str = other_diagram->border_and_titleblock.folio(); + string.replace("%F", m_F_str); + connect(&other_diagram->border_and_titleblock, &BorderTitleBlock::titleBlockFolioChanged, this, &ReportElement::updateFormulaConnection); + } + + if (other_diagram && (string.contains("%f") || string.contains("%id"))) + connect(other_diagram->project(), &QETProject::projectDiagramsOrderChanged, this, &ReportElement::updateLabel); + if (string.contains("%l")) + connect(other_elmt, &Element::yChanged, this, &ReportElement::updateLabel); + if (string.contains("%c")) + connect(other_elmt, &Element::xChanged, this, &ReportElement::updateLabel); +} + +/** + * @brief ReportElement::removeConnectionForFormula + * Remove the existing connection made for the formula @str + * @param str + */ +void ReportElement::removeConnectionForFormula(const QString &str) +{ + if (connected_elements.isEmpty() || str.isEmpty()) + return; + + QString string = str; + Element *other_element = connected_elements.first(); + Diagram *other_diagram = other_element->diagram(); + + //Because the variable %F is a reference to another text which can contain variables, + //we must to replace %F by the real text, to check if the real text contain the variable %id + if (other_diagram && string.contains("%F")) + { + string.replace("%F", m_F_str); + disconnect(&other_diagram->border_and_titleblock, &BorderTitleBlock::titleBlockFolioChanged, this, &ReportElement::updateFormulaConnection); + } + + if (other_diagram && (string.contains("%f") || string.contains("%id"))) + disconnect(other_diagram->project(), &QETProject::projectDiagramsOrderChanged, this, &ReportElement::updateLabel); + if (string.contains("%l")) + disconnect(other_element, &Element::yChanged, this, &ReportElement::updateLabel); + if (string.contains("%c")) + disconnect(other_element, &Element::xChanged, this, &ReportElement::updateLabel); +} + +void ReportElement::updateFormulaConnection() +{ + removeConnectionForFormula(m_formula); + setConnectionForFormula(m_formula); + updateLabel(); } diff --git a/sources/qetgraphicsitem/reportelement.h b/sources/qetgraphicsitem/reportelement.h index 995559131..a5fc943e2 100644 --- a/sources/qetgraphicsitem/reportelement.h +++ b/sources/qetgraphicsitem/reportelement.h @@ -37,21 +37,22 @@ class ReportElement : public CustomElement virtual void linkToElement(Element *); virtual void unlinkAllElements(); virtual void unlinkElement(Element *elmt); - - private: - int m_inverse_report; - QString m_label; - ElementTextItem *m_text_field; - Conductor *m_watched_conductor; - + private: void conductorWasAdded(Conductor *conductor); void conductorWasRemoved(Conductor *conductor); - - private slots: - void setLabel (QString label); + void setFormula (QString label); void updateLabel(); void reportPropertiesChange(const QString &old_str, const QString &new_str); + void setConnectionForFormula(const QString &str); + void removeConnectionForFormula(const QString &str); + void updateFormulaConnection(); + + private: + int m_inverse_report; + QString m_formula; + ElementTextItem *m_text_field; + Conductor *m_watched_conductor; }; #endif // REPORTELEMENT_H diff --git a/sources/qetgraphicsitem/slaveelement.cpp b/sources/qetgraphicsitem/slaveelement.cpp index dca6ee474..40e939e50 100644 --- a/sources/qetgraphicsitem/slaveelement.cpp +++ b/sources/qetgraphicsitem/slaveelement.cpp @@ -60,13 +60,14 @@ void SlaveElement::linkToElement(Element *elmt) this->disconnect(); connected_elements << elmt; - connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel())); - connect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel())); - connect(elmt, SIGNAL(elementInfoChange(DiagramContext, DiagramContext)),this, SLOT(updateLabel())); - connect(diagram()->project(), SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel())); - connect(diagram()->project(), SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel())); - connect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel())); - connect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel())); + QETProject *project = elmt->diagram()->project(); + connect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel())); + connect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel())); + connect(elmt, SIGNAL(elementInfoChange(DiagramContext, DiagramContext)), this, SLOT(updateLabel())); + connect(project, SIGNAL(projectDiagramsOrderChanged(QETProject*,int,int)), this, SLOT(updateLabel())); + connect(project, SIGNAL(diagramRemoved(QETProject*,Diagram*)), this, SLOT(updateLabel())); + connect(project, SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel())); + connect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel())); updateLabel(); elmt -> linkToElement(this); @@ -141,11 +142,11 @@ void SlaveElement::updateLabel() { no_editable = true; Element *elmt = linkedElements().first(); - label = elmt -> elementInformations()["label"].toString(); - XRefProperties xrp = elmt->diagram()->defaultXRefProperties(elmt->kindInformations()["type"].toString()); + label = elmt->elementInformations()["label"].toString(); + + XRefProperties xrp = elmt->diagram()->project()->defaultXRefProperties(elmt->kindInformations()["type"].toString()); Xreflabel = xrp.slaveLabel(); Xreflabel = autonum::AssignVariables::formulaToLabel(Xreflabel, elmt->rSequenceStruct(), elmt->diagram(), elmt); - label = autonum::AssignVariables::formulaToLabel(label, elmt->rSequenceStruct(), elmt->diagram(), elmt); } else label = autonum::AssignVariables::formulaToLabel(label, m_autoNum_seq, diagram(), this);