mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-09 21:54:13 +02:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user