mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-28 14:50:52 +01:00
Static text of element are now exported to dxf
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5896 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <QPicture>
|
||||
#include <iostream>
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
|
||||
ElementPictureFactory* ElementPictureFactory::m_factory = nullptr;
|
||||
|
||||
@@ -124,6 +125,12 @@ ElementPictureFactory::primitives ElementPictureFactory::getPrimitives(const Ele
|
||||
return m_primitives_H.value(location.uuid());
|
||||
}
|
||||
|
||||
ElementPictureFactory::~ElementPictureFactory() {
|
||||
for (primitives p : m_primitives_H.values()) {
|
||||
qDeleteAll(p.m_texts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementPictureFactory::build
|
||||
* Build the picture from location.
|
||||
@@ -523,6 +530,14 @@ void ElementPictureFactory::parseText(const QDomElement &dom, QPainter &painter,
|
||||
ctx.palette.setColor(QPalette::Text, text_color);
|
||||
text_document.documentLayout() -> draw(&painter, ctx);
|
||||
|
||||
//A very dirty workaround for export this text to dxf
|
||||
QGraphicsSimpleTextItem *qgsti = new QGraphicsSimpleTextItem();
|
||||
qgsti->setText(dom.attribute("text"));
|
||||
qgsti->setFont(font_);
|
||||
qgsti->setPos(dom.attribute("x").toDouble(), dom.attribute("y").toDouble());
|
||||
qgsti->setRotation(dom.attribute("rotation", "0").toDouble());
|
||||
prim.m_texts << qgsti;
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user