Unlink a slave element, reset her text to "_".

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4885 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2017-01-29 13:57:17 +00:00
parent 0f53d5e69e
commit 37e7477d09
2 changed files with 18 additions and 11 deletions

View File

@@ -32,7 +32,7 @@
SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) : SlaveElement::SlaveElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
CustomElement(location, qgi, state) CustomElement(location, qgi, state)
{ {
Xref_item = nullptr; m_xref_item = nullptr;
link_type_ = Slave; link_type_ = Slave;
connect(this, SIGNAL(updateLabel()), this, SLOT(updateLabel())); connect(this, SIGNAL(updateLabel()), this, SLOT(updateLabel()));
} }
@@ -109,8 +109,11 @@ void SlaveElement::unlinkElement(Element *elmt)
disconnect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel())); disconnect(elmt -> diagram(), SIGNAL(XRefPropertiesChanged()), this, SLOT(updateLabel()));
disconnect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel())); disconnect(elmt, SIGNAL(updateLabel()), this, SLOT(updateLabel()));
delete Xref_item; Xref_item = NULL; delete m_xref_item; m_xref_item = NULL;
if (ElementTextItem *eti = this->taggedText("label"))
eti->setPlainText("_");
updateLabel(); updateLabel();
elmt -> unlinkElement (this) ; elmt -> unlinkElement (this) ;
elmt -> setHighlighted (false); elmt -> setHighlighted (false);
@@ -144,16 +147,20 @@ void SlaveElement::updateLabel()
Xreflabel = autonum::AssignVariables::formulaToLabel(Xreflabel, elmt->rSequenceStruct(), elmt->diagram(), elmt); Xreflabel = autonum::AssignVariables::formulaToLabel(Xreflabel, elmt->rSequenceStruct(), elmt->diagram(), elmt);
label = autonum::AssignVariables::formulaToLabel(label, 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); else
label = autonum::AssignVariables::formulaToLabel(label, m_autoNum_seq, diagram(), this);
// set the new label // set the new label
ElementTextItem *eti = setTaggedText("label", label, no_editable); ElementTextItem *eti = setTaggedText("label", label, no_editable);
if (eti && !isFree()) { if (eti && !isFree())
if (Xref_item) Xref_item -> setPlainText(Xreflabel); {
else { if (m_xref_item)
Xref_item = new QGraphicsTextItem(Xreflabel, eti); m_xref_item->setPlainText(Xreflabel);
Xref_item -> setFont(QETApp::diagramTextsFont(5)); else
Xref_item -> setPos(eti -> boundingRect().bottomLeft()); {
m_xref_item = new QGraphicsTextItem(Xreflabel, eti);
m_xref_item->setFont(QETApp::diagramTextsFont(5));
m_xref_item->setPos(eti -> boundingRect().bottomLeft());
} }
} }
} }

View File

@@ -37,7 +37,7 @@ class SlaveElement : public CustomElement
void updateLabel(); void updateLabel();
private: private:
QGraphicsTextItem *Xref_item; QGraphicsTextItem *m_xref_item;
}; };
#endif // SLAVEELEMENT_H #endif // SLAVEELEMENT_H