[qet] qet/qet: [5794] Fix DXF export |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 5794
Author: blacksun
Date: 2019-03-16 20:13:46 +0100 (Sat, 16 Mar 2019)
Log Message:
-----------
Fix DXF export
Modified Paths:
--------------
trunk/sources/exportdialog.cpp
trunk/sources/exportpropertieswidget.cpp
trunk/sources/factory/elementpicturefactory.cpp
Modified: trunk/sources/exportdialog.cpp
===================================================================
--- trunk/sources/exportdialog.cpp 2019-03-16 17:59:17 UTC (rev 5793)
+++ trunk/sources/exportdialog.cpp 2019-03-16 19:13:46 UTC (rev 5794)
@@ -34,6 +34,7 @@
#include "diagramfoliolist.h"
#include "elementpicturefactory.h"
#include "element.h"
+#include "dynamicelementtextitem.h"
/**
Constructeur
@@ -479,6 +480,8 @@
list_images << dii;
} else if (QetShapeItem *dii = qgraphicsitem_cast<QetShapeItem *>(qgi)) {
list_shapes << dii;
+ } else if (DynamicElementTextItem *deti = qgraphicsitem_cast<DynamicElementTextItem *>(qgi)) {
+ list_texts << deti;
}
}
}
@@ -486,8 +489,8 @@
foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path, qsi->pen());
//Draw elements
- foreach(Element *elmt, list_elements) {
-
+ foreach(Element *elmt, list_elements)
+ {
double rotation_angle = elmt -> orientation() * 90;
qreal elem_pos_x = elmt -> pos().x();
@@ -627,8 +630,8 @@
if (fontSize < 0)
fontSize = dti -> font().pixelSize();
fontSize *= Createdxf::yScale;
- qreal x = (dti -> pos().x()) * Createdxf::xScale;
- qreal y = Createdxf::sheetHeight - (dti -> pos().y() * Createdxf::yScale) - fontSize*1.05;
+ qreal x = (dti->scenePos().x()) * Createdxf::xScale;
+ qreal y = Createdxf::sheetHeight - (dti->scenePos().y() * Createdxf::yScale) - fontSize*1.05;
QStringList lines = dti -> toPlainText().split('\n');
foreach (QString line, lines) {
qreal angle = 360 - (dti -> rotation());
Modified: trunk/sources/exportpropertieswidget.cpp
===================================================================
--- trunk/sources/exportpropertieswidget.cpp 2019-03-16 17:59:17 UTC (rev 5793)
+++ trunk/sources/exportpropertieswidget.cpp 2019-03-16 19:13:46 UTC (rev 5794)
@@ -145,7 +145,7 @@
format -> addItem(tr("JPEG (*.jpg)"), "JPG");
format -> addItem(tr("Bitmap (*.bmp)"), "BMP");
format -> addItem(tr("SVG (*.svg)"), "SVG");
- //format -> addItem(tr("DXF (*.dxf)"), "DXF");
+ format -> addItem(tr("DXF (*.dxf)"), "DXF");
hboxLayout1 -> addStretch();
vboxLayout -> addLayout(hboxLayout1);
Modified: trunk/sources/factory/elementpicturefactory.cpp
===================================================================
--- trunk/sources/factory/elementpicturefactory.cpp 2019-03-16 17:59:17 UTC (rev 5793)
+++ trunk/sources/factory/elementpicturefactory.cpp 2019-03-16 19:13:46 UTC (rev 5794)
@@ -170,8 +170,6 @@
painter.begin(picture);
}
else {
- m_pictures_H.insert(location.uuid(), pic);
- m_primitives_H.insert(location.uuid(), primitives_);
painter.begin(&pic);
}
painter.setRenderHint(QPainter::Antialiasing, true);
@@ -185,8 +183,6 @@
low_painter.begin(low_picture);
}
else {
- m_low_pictures_H.insert(location.uuid(), low_pic);
- m_primitives_H.insert(location.uuid(), primitives_);
low_painter.begin(&low_pic);
}
low_painter.setRenderHint(QPainter::Antialiasing, true);
@@ -225,6 +221,15 @@
//End of the drawing
painter.end();
low_painter.end();
+
+ if (!picture) {
+ m_pictures_H.insert(location.uuid(), pic);
+ m_primitives_H.insert(location.uuid(), primitives_);
+ }
+ if (!low_picture) {
+ m_low_pictures_H.insert(location.uuid(), low_pic);
+ m_primitives_H.insert(location.uuid(), primitives_);
+ }
return true;
}