mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Element : edit an element text item (with tagg) directly on the folio, also update the information of the element.
For exemple, edit the element text item tagged "label", update the value with key "label" of element information. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4804 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -265,59 +265,6 @@ void CustomElement::paint(QPainter *qp, const QStyleOptionGraphicsItem *options)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves the element label stored in file ./elements/ * /qet_labels.xml
|
||||
The labels are applied to all elements inside a folder. If an element
|
||||
has a specific label, it will be applied. See qet_labels.xml for more
|
||||
instructions.
|
||||
*/
|
||||
void CustomElement::parseLabels()
|
||||
{
|
||||
QString formula = location().project()->elementAutoNumCurrentFormula();
|
||||
DiagramContext &dc = rElementInformations();
|
||||
|
||||
//element is being added
|
||||
if (taggedText("label") && (location().projectId()!=-1) && (taggedText("label")->toPlainText()=="_"))
|
||||
{
|
||||
if (getPrefix().isEmpty())
|
||||
{
|
||||
if (!formula.isEmpty() && (this->linkType() != Element::Slave))
|
||||
{
|
||||
dc.addValue("label", formula);
|
||||
this->setTaggedText("label",formula);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if there is a formula to assign, assign it
|
||||
if (!formula.isEmpty() && (this->linkType() != Element::Slave))
|
||||
{
|
||||
dc.addValue("label", formula);
|
||||
this->setTaggedText("label",formula);
|
||||
}
|
||||
else
|
||||
{ //assign only prefix
|
||||
dc.addValue("label", "%prefix");
|
||||
this->setTaggedText("label", getPrefix());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//apply formula to specific label - This condition specify elements which have different labels e.g KM
|
||||
//that are already specified in the element label (inside .elmt file). This method is not called if elements
|
||||
//are being loaded at first time or being pasted
|
||||
else if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) &&
|
||||
(!location().project()->elementAutoNumCurrentFormula().isEmpty()) &&
|
||||
(this->linkType()!=Element::Slave) && !this->diagram()->item_paste)
|
||||
{
|
||||
QString prefix = this->taggedText("label")->toPlainText();
|
||||
this->setPrefix(prefix);
|
||||
dc.addValue("label", formula);
|
||||
this->setTaggedText("label",formula);
|
||||
this->setElementInformations(dc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Analyse et prend en compte un element XML decrivant une partie du dessin
|
||||
de l'element perso. Si l'analyse reussit, la partie est ajoutee au dessin.
|
||||
@@ -767,6 +714,8 @@ ElementTextItem *CustomElement::parseInput(QDomElement &e) {
|
||||
|
||||
list_texts_ << eti;
|
||||
|
||||
connect(eti, &ElementTextItem::diagramTextChanged, this, &Element::textItemChanged);
|
||||
|
||||
return(eti);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user