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 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-09 16:31:16 +13:00
parent 1db025ceae
commit 3b0824c3ef
+2 -2
View File
@@ -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));