slave element: when linked to master, label is replaced by the label of master, and show the position of the master

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2946 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-03-21 14:40:33 +00:00
parent a35c2dc022
commit 0109a5d188
7 changed files with 95 additions and 5 deletions

View File

@@ -711,18 +711,19 @@ ElementTextItem *CustomElement::parseInput(QDomElement &e) {
ElementTextItem *eti = new ElementTextItem(e.attribute("text"), this);
eti -> setFont(QETApp::diagramTextsFont(size));
eti -> setTagg(e.attribute("tagg", "other"));
// position du champ de texte
// position the text field
eti -> setOriginalPos(QPointF(pos_x, pos_y));
eti -> setPos(pos_x, pos_y);
// rotation du champ de texte
// rotation of the text field
qreal original_rotation_angle = 0.0;
QET::attributeIsAReal(e, "rotation", &original_rotation_angle);
eti -> setOriginalRotationAngle(original_rotation_angle);
eti -> setRotationAngle(original_rotation_angle);
// comportement du champ lorsque son element parent est pivote
// behavior when the parent element is rotated
eti -> setFollowParentRotations(e.attribute("rotate") == "true");
list_texts_ << eti;
@@ -900,3 +901,22 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) {
// mise en place (ou non) de l'antialiasing
setQPainterAntiAliasing(qp, e.attribute("antialias") == "true");
}
/**
* @brief CustomElement::setTaggedText
* Set text @newstr to the text tagged with @tagg.
* If tagg is found return the text item, else return 0.
* @param tagg required tagg
* @param newstr new label
* @param noeditable set editable or not (by default, set editable)
*/
ElementTextItem* CustomElement::setTaggedText(const QString &tagg, const QString &newstr, const bool noeditable) {
foreach (ElementTextItem *eti, list_texts_) {
if (eti -> tagg() == tagg) {
eti -> setPlainText(newstr);
eti -> setNoEditable(noeditable);
return eti;
}
}
return 0;
}