[qet] [2738] DXF Export: Multi-line text can be exported

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2738
Author:   abhishekm71
Date:     2014-01-12 18:02:30 +0100 (Sun, 12 Jan 2014)
Log Message:
-----------
DXF Export: Multi-line text can be exported

Modified Paths:
--------------
    trunk/sources/exportdialog.cpp

Modified: trunk/sources/exportdialog.cpp
===================================================================
--- trunk/sources/exportdialog.cpp	2014-01-12 13:22:16 UTC (rev 2737)
+++ trunk/sources/exportdialog.cpp	2014-01-12 17:02:30 UTC (rev 2738)
@@ -418,8 +418,14 @@
 			qreal x = hot_spot_x + dti -> pos().x();
 			x *= Createdxf::xScale;
 			qreal y = hot_spot_y + dti -> pos().y();
-			y = Createdxf::sheetHeight - (y * Createdxf::yScale) - fontSize;
-			Createdxf::drawText(file_path, dti -> toPlainText(), x, y, fontSize, dti -> rotationAngle(), 0 );
+			y = Createdxf::sheetHeight - (y * Createdxf::yScale);// - fontSize;
+			QStringList lines = dti -> toPlainText().split('\n');
+			y += (fontSize/2) * (lines.count()-1);
+			foreach (QString line, lines) {
+				Createdxf::drawText(file_path, line, x, y, fontSize, dti -> rotationAngle(), 0 );
+				y -= fontSize*1.06;
+			}
+
 		}
 
 		QList<QLineF *> elmt_line = elmt -> lines();
@@ -501,8 +507,13 @@
 				fontSize = textItem -> font().pixelSize();
 			fontSize *= Createdxf::yScale;
 			qreal x = (textItem -> pos().x()) * Createdxf::xScale;
-			qreal y = Createdxf::sheetHeight - (textItem -> pos().y() * Createdxf::yScale) - fontSize*1.05;
-			Createdxf::drawText(file_path, textItem -> toPlainText(), x, y, fontSize, textItem -> rotationAngle(), 0 );
+			qreal y = Createdxf::sheetHeight - (textItem -> pos().y() * Createdxf::yScale) - fontSize;
+			QStringList lines = textItem->toPlainText().split('\n');
+			foreach (QString line, lines) {
+				Createdxf::drawText(file_path, line, x, y, fontSize, textItem -> rotationAngle(), 0 );
+				y -= fontSize*1.06;
+			}
+
 		}
 	}
 
@@ -514,7 +525,11 @@
 		fontSize *= Createdxf::yScale;
 		qreal x = (dti -> pos().x()) * Createdxf::xScale;
 		qreal y = Createdxf::sheetHeight - (dti -> pos().y() * Createdxf::yScale) - fontSize*1.05;
-		Createdxf::drawText(file_path, dti -> toPlainText(), x, y, fontSize, dti -> rotationAngle(), 0 );
+		QStringList lines = dti -> toPlainText().split('\n');
+		foreach (QString line, lines) {
+			Createdxf::drawText(file_path, line, x, y, fontSize, dti -> rotationAngle(), 0 );
+			y -= fontSize*1.06;
+		}
 	}
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/