mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-07 12:14:14 +02:00
Export wrapped texts to DXF line by line
A symbol text with a width (text_width) is drawn wrapped on the folio, but the DXF export split texts on '\n' only, so it was written as one long line, running past its box and over the drawing. The export now writes the lines of folio texts as they are laid out (TextLines::layoutLines(), new header-only textlines.h). Texts without a width give the same lines as before. Tests: tst_textlines, tst_dxfwrappedtext (fails without this change). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "qetgraphicsitem/independenttextitem.h"
|
||||
#include "qetgraphicsitem/qetshapeitem.h"
|
||||
#include "qetgraphicsitem/terminal.h"
|
||||
#include "textlines.h"
|
||||
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
#include <QSet>
|
||||
@@ -358,7 +359,8 @@ void DxfExport::write(Diagram *diagram, int width, int height,
|
||||
qreal y = dti->scenePos().y()
|
||||
- ydir * fontSize * 1.8
|
||||
- xdir * fontSize * 0.9;
|
||||
QStringList lines = dti -> toPlainText().split('\n');
|
||||
//As drawn: a text with a width is wrapped
|
||||
QStringList lines = TextLines::layoutLines(dti -> document());
|
||||
qreal offset = fontSize * 1.6;
|
||||
foreach (QString line, lines) {
|
||||
if (line.size() > 0 && line != "_" )
|
||||
|
||||
Reference in New Issue
Block a user