From d6f418fa83beec0d95b187b62022cdce00f589d6 Mon Sep 17 00:00:00 2001 From: blacksun Date: Sun, 11 Mar 2018 16:04:44 +0000 Subject: [PATCH] fix indentation git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5266 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- .../graphicspart/partdynamictextfield.cpp | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/sources/editor/graphicspart/partdynamictextfield.cpp b/sources/editor/graphicspart/partdynamictextfield.cpp index 1aba5b242..de7f854eb 100644 --- a/sources/editor/graphicspart/partdynamictextfield.cpp +++ b/sources/editor/graphicspart/partdynamictextfield.cpp @@ -187,33 +187,33 @@ void PartDynamicTextField::fromTextFieldXml(const QDomElement &dom_element) if(dom_element.tagName() != "input") return; - setFont(QETApp::diagramTextsFont(dom_element.attribute("size", QString::number(9)).toInt())); - - if(dom_element.attribute("tagg", "none") == "none") - { - setTextFrom(DynamicElementTextItem::UserText); - setText(dom_element.attribute("text", "_")); - } - else - { - setTextFrom(DynamicElementTextItem::ElementInfo); - setInfoName(dom_element.attribute("tagg", "label")); - } - - QGraphicsTextItem::setRotation(dom_element.attribute("rotation", "0").toDouble()); - - //the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size - //The origin transformation point of PartTextField is the middle of left edge, and so by definition, change with the size of the font - //We need to use a QMatrix to find the pos of this text from the saved pos of text item - QMatrix matrix; - //First make the rotation - matrix.rotate(dom_element.attribute("rotation", "0").toDouble()); - QPointF pos = matrix.map(QPointF(0, -boundingRect().height()/2)); - matrix.reset(); - //Second translate to the pos - matrix.translate(dom_element.attribute("x", QString::number(0)).toDouble(), - dom_element.attribute("y", QString::number(0)).toDouble()); - QGraphicsTextItem::setPos(matrix.map(pos)); + setFont(QETApp::diagramTextsFont(dom_element.attribute("size", QString::number(9)).toInt())); + + if(dom_element.attribute("tagg", "none") == "none") + { + setTextFrom(DynamicElementTextItem::UserText); + setText(dom_element.attribute("text", "_")); + } + else + { + setTextFrom(DynamicElementTextItem::ElementInfo); + setInfoName(dom_element.attribute("tagg", "label")); + } + + QGraphicsTextItem::setRotation(dom_element.attribute("rotation", "0").toDouble()); + + //the origin transformation point of PartDynamicTextField is the top left corner, no matter the font size + //The origin transformation point of PartTextField is the middle of left edge, and so by definition, change with the size of the font + //We need to use a QMatrix to find the pos of this text from the saved pos of text item + QMatrix matrix; + //First make the rotation + matrix.rotate(dom_element.attribute("rotation", "0").toDouble()); + QPointF pos = matrix.map(QPointF(0, -boundingRect().height()/2)); + matrix.reset(); + //Second translate to the pos + matrix.translate(dom_element.attribute("x", QString::number(0)).toDouble(), + dom_element.attribute("y", QString::number(0)).toDouble()); + QGraphicsTextItem::setPos(matrix.map(pos)); } /**