diff --git a/src/Mod/TechDraw/Gui/QGCustomText.cpp b/src/Mod/TechDraw/Gui/QGCustomText.cpp index c52aecf3f7..8df5d73b4f 100644 --- a/src/Mod/TechDraw/Gui/QGCustomText.cpp +++ b/src/Mod/TechDraw/Gui/QGCustomText.cpp @@ -59,12 +59,13 @@ QGCustomText::QGCustomText() void QGCustomText::centerAt(QPointF centerPos) { - QRectF box = boundingRect(); - double width = box.width(); - double height = box.height(); - double newX = centerPos.x() - width/2.; - double newY = centerPos.y() - height/2.; - setPos(newX,newY); + centerAt(centerPos.x(),centerPos.y()); +// QRectF box = boundingRect(); +// double width = box.width(); +// double height = box.height(); +// double newX = centerPos.x() - width/2.; +// double newY = centerPos.y() - height/2.; +// setPos(newX,newY); } void QGCustomText::centerAt(double cX, double cY) diff --git a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp index c474952a07..2f4ae2bc4d 100644 --- a/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp @@ -162,6 +162,15 @@ void QGIViewAnnotation::drawAnnotation() m_textItem->setTextWidth(Rez::guiX(viewAnno->MaxWidth.getValue())); QString qs = QString::fromUtf8(ss.str().c_str()); m_textItem->setHtml(qs); - m_textItem->setPos(0.,0.); + m_textItem->centerAt(0.,0.); } +void QGIViewAnnotation::rotateView(void) +{ + QRectF r = m_textItem->boundingRect(); + m_textItem->setTransformOriginPoint(r.center()); + double rot = getViewObject()->Rotation.getValue(); + m_textItem->setRotation(-rot); +} + + diff --git a/src/Mod/TechDraw/Gui/QGIViewAnnotation.h b/src/Mod/TechDraw/Gui/QGIViewAnnotation.h index 6a8ffba995..99891c8e32 100644 --- a/src/Mod/TechDraw/Gui/QGIViewAnnotation.h +++ b/src/Mod/TechDraw/Gui/QGIViewAnnotation.h @@ -50,6 +50,7 @@ public: void setViewAnnoFeature(TechDraw::DrawViewAnnotation *obj); virtual void draw() override; + virtual void rotateView(void) override; protected: void drawAnnotation();