From 3b0824c3ef5379f713d74a0c0927d02e427e56e3 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Fri, 9 Oct 2026 16:31:16 +1300 Subject: [PATCH] Element editor: mirror a multi-line static text by its widest line PartText::mirror() measured the whole text as one line, so a text of several lines landed off by the width of the other lines (18 px for "A\nLONGER LINE" at 20 pt). Co-Authored-By: Claude Opus 5.5 --- sources/editor/graphicspart/parttext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/editor/graphicspart/parttext.cpp b/sources/editor/graphicspart/parttext.cpp index 4fa4d9c4d..a3ae56d76 100644 --- a/sources/editor/graphicspart/parttext.cpp +++ b/sources/editor/graphicspart/parttext.cpp @@ -89,8 +89,8 @@ void PartText::mirror(qreal axis_x) { // at first: rotate the text: QGraphicsObject::setRotation(QET::correctAngle((360-rotation()), true)); // then see, where we need to re-position depending on text, font ... - QFontMetrics qfm(font()); - qreal textwidth = qfm.horizontalAdvance(toPlainText()); + // (the widest line, not the whole text measured as one line) + qreal textwidth = document()->idealWidth() - 2 * document()->documentMargin(); // ... and angle!!! qreal rot = qRound(QET::correctAngle(rotation(), true)); qreal c = qCos(qDegreesToRadians(rot));