View Issue Details

IDProjectCategoryView StatusLast Update
0000153QElectroTechwebsitepublic2021-02-15 00:48
Reportergabberworld Assigned Toblack_sun_2012  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionreopened 
Platform64OSwindowsOS Version10
Summary0000153: DXF Export
Descriptionit makes the text and other stuff double in dxf file

it also not disable bolders and titles when i select them, for that i made patch

TagsNo tags attached.
Attached Files
exportdialog.cpp.patch (1,385 bytes)   
Index: exportdialog.cpp
===================================================================
--- exportdialog.cpp	(revision 5229)
+++ exportdialog.cpp	(working copy)
@@ -398,6 +398,7 @@
 	@param io_device Peripherique de sortie pour le code DXF (souvent : un fichier)
 */
 void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool keep_aspect_ratio, QString &file_path) {
+    saveReloadDiagramParameters(diagram, true);
 
 	project_ -> setFilePath(file_path);
 
@@ -410,8 +411,10 @@
 	Createdxf::dxfBegin(file_path);
 
 	//Add project elements (lines, rectangles, circles, texts) to dxf file
-	Createdxf::drawRectangle(file_path, 0, 0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0);
-	diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0);
+    if (epw -> exportProperties().draw_border) {
+    Createdxf::drawRectangle(file_path, 0, 0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0);
+    }
+    diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0);
 
 	// Build the lists of elements.
 	QList<Element *> list_elements;
@@ -677,6 +680,8 @@
 		}
 	}
 	Createdxf::dxfEnd(file_path);
+
+    saveReloadDiagramParameters(diagram, false);
 }
 
 void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString author, QString title,
exportdialog.cpp.patch (1,385 bytes)   

Activities

gabberworld

2018-02-06 20:28

reporter   ~0000296

what i find out that probem starts at customelement.cpp in line 190

it generates double elements at there with parseElement

				if (parseElement(qde, qp))
                {
                    ++ parsed_elements_count;
                    QString current_tag = qde.tagName();
                    if (current_tag != "terminal" && current_tag != "input" && current_tag != "dynamic_text")
                    {
                        forbid_antialiasing = true;
                    //	parseElement(qde, low_zoom_qp); <<-- probem here with double adding
                        forbid_antialiasing = false;
                    }
                }
                else
                {
                    if (state)
                        *state = 7;
                    
                    return(false);
                }

gabberworld

2018-02-11 16:26

reporter   ~0000299

Patch for some colors inside dxf
dxf.color.patch (7,876 bytes)   
Index: createdxf.cpp
===================================================================
--- createdxf.cpp	(revision 5237)
+++ createdxf.cpp	(working copy)
@@ -323,7 +323,92 @@
     }
 }
 
+long Createdxf::RGBcodeTable[255]{
+    0x000000,    0xff0000,    0xffff00,    0x00ff00,    0x00ffff,
+    0x0000ff,    0xff00ff,    0xffffff,    0x414141,    0x808080,
+    0xff0000,    0xffaaaa,    0xbd0000,    0xbd7e7e,    0x810000,
+    0x815656,    0x680000,    0x684545,    0x4f0000,    0x4f3535,
+    0xff3f00,    0xffbfaa,    0xbd2e00,    0xbd8d7e,    0x811f00,
+    0x816056,    0x681900,    0x684e45,    0x4f1300,    0x4f3b35,
+    0xff7f00,    0xffd4aa,    0xbd5e00,    0xbd9d7e,    0x814000,
+    0x816b56,    0x683400,    0x685645,    0x4f2700,    0x4f4235,
+    0xffbf00,    0xffeaaa,    0xbd8d00,    0xbdad7e,    0x816000,
+    0x817656,    0x684e00,    0x685f45,    0x4f3b00,    0x4f4935,
+    0xffff00,    0xffffaa,    0xbdbd00,    0xbdbd7e,    0x818100,
+    0x818156,    0x686800,    0x686845,    0x4f4f00,    0x4f4f35,
+    0xbfff00,    0xeaffaa,    0x8dbd00,    0xadbd7e,    0x608100,
+    0x768156,    0x4e6800,    0x5f6845,    0x3b4f00,    0x494f35,
+    0x7fff00,    0xd4ffaa,    0x5ebd00,    0x9dbd7e,    0x408100,
+    0x6b8156,    0x346800,    0x566845,    0x274f00,    0x424f35,
+    0x3fff00,    0xbfffaa,    0x2ebd00,    0x8dbd7e,    0x1f8100,
+    0x608156,    0x196800,    0x4e6845,    0x134f00,    0x3b4f35,
+    0x00ff00,    0xaaffaa,    0x00bd00,    0x7ebd7e,    0x008100,
+    0x568156,    0x006800,    0x456845,    0x004f00,    0x354f35,
+    0x00ff3f,    0xaaffbf,    0x00bd2e,    0x7ebd8d,    0x00811f,
+    0x568160,    0x006819,    0x45684e,    0x004f13,    0x354f3b,
+    0x00ff7f,    0xaaffd4,    0x00bd5e,    0x7ebd9d,    0x008140,
+    0x56816b,    0x006834,    0x456856,    0x004f27,    0x354f42,
+    0x00ffbf,    0xaaffea,    0x00bd8d,    0x7ebdad,    0x008160,
+    0x568176,    0x00684e,    0x45685f,    0x004f3b,    0x354f49,
+    0x00ffff,    0xaaffff,    0x00bdbd,    0x7ebdbd,    0x008181,
+    0x568181,    0x006868,    0x456868,    0x004f4f,    0x354f4f,
+    0x00bfff,    0xaaeaff,    0x008dbd,    0x7eadbd,    0x006081,
+    0x567681,    0x004e68,    0x455f68,    0x003b4f,    0x35494f,
+    0x007fff,    0xaad4ff,    0x005ebd,    0x7e9dbd,    0x004081,
+    0x566b81,    0x003468,    0x455668,    0x00274f,    0x35424f,
+    0x003fff,    0xaabfff,    0x002ebd,    0x7e8dbd,    0x001f81,
+    0x566081,    0x001968,    0x454e68,    0x00134f,    0x353b4f,
+    0x0000ff,    0xaaaaff,    0x0000bd,    0x7e7ebd,    0x000081,
+    0x565681,    0x000068,    0x454568,    0x00004f,    0x35354f,
+    0x3f00ff,    0xbfaaff,    0x2e00bd,    0x8d7ebd,    0x1f0081,
+    0x605681,    0x190068,    0x4e4568,    0x13004f,    0x3b354f,
+    0x7f00ff,    0xd4aaff,    0x5e00bd,    0x9d7ebd,    0x400081,
+    0x6b5681,    0x340068,    0x564568,    0x27004f,    0x42354f,
+    0xbf00ff,    0xeeaaff,    0x8d00bd,    0xad7ebd,    0x600081,
+    0x765681,    0x4e0068,    0x5f4568,    0x3b004f,    0x49354f,
+    0xff00ff,    0xffaaff,    0xbd00bd,    0xbd7ebd,    0x810081,
+    0x815681,    0x680068,    0x684568,    0x4f004f,    0x4f354f,
+    0xff00bf,    0xffaaea,    0xbd008d,    0xbd7ead,    0x810060,
+    0x815676,    0x68004e,    0x68455f,    0x4f003b,    0x4f3549,
+    0xff007f,    0xffaad4,    0xbd005e,    0xbd7e9d,    0x810040,
+    0x81566b,    0x680034,    0x684556,    0x4f0027,    0x4f3542,
+    0xff003f,    0xffaabf,    0xbd002e,    0xbd7e8d,    0x81001f,
+    0x815660,    0x680019,    0x68454e,    0x4f0013,    0x4f353b,
+    0x333333,    0x505050,    0x696969,    0x828282,    0xbebebe
+};
+
 /**
+ * @brief Createdxf::getcolorCode
+ * This function returns the ACI color which is the "nearest" color to
+ * the color defined by the red, green and blue (RGB) values passed
+ * in argument.
+ * @param red
+ * @param green
+ * @param blue
+ */
+int Createdxf::getcolorCode (const long red, const long green, const long blue)
+{
+   long acirgb, r,g,b;
+   long mindst = 2147483647L;
+   long dst = 0;
+   int minndx = 0;
+   for ( int i = 0; i < 254; i++ )
+   {
+      acirgb = RGBcodeTable[i];
+      b = ( acirgb & 0xffL );
+      g = ( acirgb & 0xff00L ) >> 8;
+      r = acirgb >> 16;
+      dst = abs ( r-red) + abs ( g -green) + abs (b-blue);
+      if ( dst < mindst )
+      {
+         minndx = i;
+         mindst = dst;
+      }
+   }
+   return minndx;
+}
+
+/**
  * @brief Createdxf::drawLine
  * Conveniance function to draw line
  * @param filepath
Index: createdxf.h
===================================================================
--- createdxf.h	(revision 5237)
+++ createdxf.h	(working copy)
@@ -48,7 +48,11 @@
 	static void drawText(QString,QString,double,double,double,double,int);
 	static void drawTextAligned(QString fileName, QString text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign, int colour, bool leftAlign = false, float scale = 0);
 
-	static const double sheetWidth;
+
+    static int getcolorCode (const long red, const long green, const long blue);
+    static long RGBcodeTable[];
+
+    static const double sheetWidth;
 	static const double sheetHeight;
 	static double		xScale;
 	static double		yScale;
Index: exportdialog.cpp
===================================================================
--- exportdialog.cpp	(revision 5237)
+++ exportdialog.cpp	(working copy)
@@ -483,7 +483,7 @@
 		}
 	}
 
-	foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path);
+	foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path, qsi->pen());
 
 	//Draw elements
 	foreach(Element *elmt, list_elements) {
Index: qetgraphicsitem/qetshapeitem.cpp
===================================================================
--- qetgraphicsitem/qetshapeitem.cpp	(revision 5237)
+++ qetgraphicsitem/qetshapeitem.cpp	(working copy)
@@ -666,13 +666,14 @@
  * @param filepath file path of the the dxf document
  * @return true if draw success
  */
-bool QetShapeItem::toDXF(const QString &filepath)
+bool QetShapeItem::toDXF(const QString &filepath,const QPen &pen)
 {
-	switch (m_shapeType)
+
+    switch (m_shapeType)
 	{
-		case Line:      Createdxf::drawLine     (filepath, QLineF(mapToScene(m_P1), mapToScene(m_P2)), 0);              return true;
-		case Rectangle: Createdxf::drawRectangle(filepath, QRectF(mapToScene(m_P1), mapToScene(m_P2)).normalized(), 0); return true;
-		case Ellipse:   Createdxf::drawEllipse  (filepath, QRectF(mapToScene(m_P1), mapToScene(m_P2)).normalized(), 0); return true;
+        case Line:      Createdxf::drawLine     (filepath, QLineF(mapToScene(m_P1), mapToScene(m_P2)), Createdxf::getcolorCode(pen.color().red(),pen.color().green(),pen.color().blue()));              return true;
+        case Rectangle: Createdxf::drawRectangle(filepath, QRectF(mapToScene(m_P1), mapToScene(m_P2)).normalized(), Createdxf::getcolorCode(pen.color().red(),pen.color().green(),pen.color().blue())); return true;
+        case Ellipse:   Createdxf::drawEllipse  (filepath, QRectF(mapToScene(m_P1), mapToScene(m_P2)).normalized(), Createdxf::getcolorCode(pen.color().red(),pen.color().green(),pen.color().blue())); return true;
 		default: return false;
 	}
 }
Index: qetgraphicsitem/qetshapeitem.h
===================================================================
--- qetgraphicsitem/qetshapeitem.h	(revision 5237)
+++ qetgraphicsitem/qetshapeitem.h	(working copy)
@@ -71,7 +71,7 @@
 
 		virtual bool	    fromXml (const QDomElement &);
 		virtual QDomElement toXml	(QDomDocument &document) const;
-		virtual bool		toDXF	(const QString &filepath);
+		virtual bool		toDXF	(const QString &filepath,const QPen &pen);
 
 		void editProperty() override;
 		QString name() const override;
dxf.color.patch (7,876 bytes)   

scorpio810

2018-02-11 17:15

administrator   ~0000300

Added, thanks.

gabberworld

2018-03-01 10:01

reporter   ~0000316

it's not fixed yet.
i have no idea what for is used the parseElement(qde, low_zoom_qp); soo there not have patch yet for that from me

scorpio810

2018-03-01 20:15

administrator   ~0000317

[19:40] <joshua> in custom item
[19:40] <joshua> There are two QPixmaps
[19:40] <joshua> QPicture
[19:40] <joshua> one for the normal zoom
[19:40] <joshua> and another for the low zoom
[19:41] <scorpio810> ah? ok
[19:41] <joshua> // Init the QPainter for draw the elemennt
[19:41] <joshua> QPainter qp;
[19:41] <joshua> qp.begin (& drawing);
[19:41] <joshua> QPainter low_zoom_qp;
[19:41] <joshua> low_zoom_qp.begin (& low_zoom_drawing);
[19:41] <joshua> QPen tmp;
[19:41] <joshua> tmp.setWidthF (1.0); // Vaudoo line to take into account the setCosmetic - do not remove
[19:41] <joshua> tmp.setCosmetic (true);
[19:41] <joshua> low_zoom_qp.setPen (tmp);
[19:41] <joshua> voila the difference
[19:42] <joshua> drawing is the normal
[19:42] <joshua> and low_zoom_drawing, as are indicated

gabberworld

2018-03-01 23:22

reporter   ~0000318

not fixed, all custom elements double

gabberworld

2018-03-01 23:25

reporter   ~0000319

parseElement self loads element to element list if you call parseElement 2 times then it loads all elements 2 times

gabberworld

2018-03-04 10:49

reporter   ~0000320

Patch for that issue.
qetgraphicsitem.patch (12,180 bytes)   
Index: customelement.cpp
===================================================================
--- customelement.cpp	(revision 5253)
+++ customelement.cpp	(working copy)
@@ -189,14 +189,15 @@
 				
 				if (parseElement(qde, qp))
 				{
-					++ parsed_elements_count;
-					QString current_tag = qde.tagName();
-					if (current_tag != "terminal" && current_tag != "input" && current_tag != DynamicElementTextItem::xmlTaggName())
-					{
-						forbid_antialiasing = true;
-						parseElement(qde, low_zoom_qp);
+                    ++ parsed_elements_count;
+
+                    QString current_tag = qde.tagName();
+                    if (current_tag != "terminal" && current_tag != "input" && current_tag != DynamicElementTextItem::xmlTaggName())
+                    {
+                        forbid_antialiasing = true;
+                        parseElement(qde, low_zoom_qp, false);
 						forbid_antialiasing = false;
-					}
+                    }
 				}
 				else
 				{
@@ -211,7 +212,7 @@
 
 		//End of the drawing
 	qp.end();
-	low_zoom_qp.end();
+    low_zoom_qp.end();
 
 
 		//They must be at least one parsed graphics part
@@ -299,11 +300,11 @@
 	@param options Les options graphiques
 */
 void CustomElement::paint(QPainter *qp, const QStyleOptionGraphicsItem *options) {
-	if (options && options -> levelOfDetail < 1.0) {
-		low_zoom_drawing.play(qp);
-	} else {
-		drawing.play(qp);
-	}
+    if (options && options -> levelOfDetail < 1.0) {
+        low_zoom_drawing.play(qp);
+    } else {
+        drawing.play(qp);
+    }
 }
 
 /**
@@ -318,16 +319,16 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parseElement(QDomElement &e, QPainter &qp)
+bool CustomElement::parseElement(QDomElement &e, QPainter &qp, bool addtolist)
 {
 	if      (e.tagName() == "terminal")     return(parseTerminal(e));
-	else if (e.tagName() == "line")         return(parseLine(e, qp));
-	else if (e.tagName() == "rect")         return(parseRect(e, qp));
-	else if (e.tagName() == "ellipse")      return(parseEllipse(e, qp));
-	else if (e.tagName() == "circle")       return(parseCircle(e, qp));
-	else if (e.tagName() == "arc")          return(parseArc(e, qp));
-	else if (e.tagName() == "polygon")      return(parsePolygon(e, qp));
-	else if (e.tagName() == "text")         return(parseText(e, qp));
+    else if (e.tagName() == "line")         return(parseLine(e, qp, addtolist));
+    else if (e.tagName() == "rect")         return(parseRect(e, qp, addtolist));
+    else if (e.tagName() == "ellipse")      return(parseEllipse(e, qp, addtolist));
+    else if (e.tagName() == "circle")       return(parseCircle(e, qp, addtolist));
+    else if (e.tagName() == "arc")          return(parseArc(e, qp, addtolist));
+    else if (e.tagName() == "polygon")      return(parsePolygon(e, qp, addtolist));
+    else if (e.tagName() == "text")         return(parseText(e, qp, addtolist));
 	else if (e.tagName() == "input")        return(parseInput(e));
 	else if (e.tagName() == "dynamic_text") return(parseDynamicText(e));
 	else return(true);
@@ -344,7 +345,7 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parseLine(QDomElement &e, QPainter &qp) {
+bool CustomElement::parseLine(QDomElement &e, QPainter &qp, bool addtolist) {
 	// verifie la presence et la validite des attributs obligatoires
 	qreal x1, y1, x2, y2;
 	if (!QET::attributeIsAReal(e, QString("x1"), &x1)) return(false);
@@ -366,9 +367,11 @@
 
 	QLineF line(x1, y1, x2, y2);
 
+    if (addtolist){
 	//Add line to the list
-	QLineF *newLine = new QLineF(line);
-	m_lines << newLine;
+        QLineF *newLine = new QLineF(line);
+        m_lines << newLine;
+    }
 
 	QPointF point1(line.p1());
 	QPointF point2(line.p2());
@@ -458,7 +461,7 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parseRect(QDomElement &e, QPainter &qp) {
+bool CustomElement::parseRect(QDomElement &e, QPainter &qp, bool addtolist) {
 	// verifie la presence des attributs obligatoires
 	qreal rect_x, rect_y, rect_w, rect_h;
 	if (!QET::attributeIsAReal(e, QString("x"),       &rect_x))  return(false);
@@ -466,9 +469,11 @@
 	if (!QET::attributeIsAReal(e, QString("width"),   &rect_w))  return(false);
 	if (!QET::attributeIsAReal(e, QString("height"),  &rect_h))  return(false);
 
-	//Add rectangle to the list
-	QRectF *rect = new QRectF(rect_x, rect_y, rect_w, rect_h);
-	m_rectangles << rect;
+    if (addtolist){
+        //Add rectangle to the list
+        QRectF *rect = new QRectF(rect_x, rect_y, rect_w, rect_h);
+        m_rectangles << rect;
+    }
 
 	qp.save();
 	setPainterStyle(e, qp);
@@ -495,7 +500,7 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parseCircle(QDomElement &e, QPainter &qp) {
+bool CustomElement::parseCircle(QDomElement &e, QPainter &qp, bool addtolist) {
 	// verifie la presence des attributs obligatoires
 	qreal cercle_x, cercle_y, cercle_r;
 	if (!QET::attributeIsAReal(e, QString("x"),        &cercle_x)) return(false);
@@ -505,9 +510,11 @@
 	setPainterStyle(e, qp);
 	QRectF circle_bounding_rect(cercle_x, cercle_y, cercle_r, cercle_r);
 
-	// Add circle to list
-	QRectF *circle = new QRectF(circle_bounding_rect);
-	m_circles << circle;
+    if (addtolist){
+        // Add circle to list
+        QRectF *circle = new QRectF(circle_bounding_rect);
+        m_circles << circle;
+    }
 
 	qp.drawEllipse(circle_bounding_rect);
 	qp.restore();
@@ -527,7 +534,7 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parseEllipse(QDomElement &e, QPainter &qp) {
+bool CustomElement::parseEllipse(QDomElement &e, QPainter &qp, bool addtolist) {
 	// verifie la presence des attributs obligatoires
 	qreal ellipse_x, ellipse_y, ellipse_l, ellipse_h;
 	if (!QET::attributeIsAReal(e, QString("x"),       &ellipse_x))  return(false);
@@ -537,14 +544,16 @@
 	qp.save();
 	setPainterStyle(e, qp);
 
-	QVector<qreal> *arc = new QVector<qreal>;
-	arc -> push_back(ellipse_x);
-	arc -> push_back(ellipse_y);
-	arc -> push_back(ellipse_l);
-	arc -> push_back(ellipse_h);
-	arc -> push_back(0);
-	arc -> push_back(360);
-	m_arcs << arc;
+    if (addtolist){
+        QVector<qreal> *arc = new QVector<qreal>;
+        arc -> push_back(ellipse_x);
+        arc -> push_back(ellipse_y);
+        arc -> push_back(ellipse_l);
+        arc -> push_back(ellipse_h);
+        arc -> push_back(0);
+        arc -> push_back(360);
+        m_arcs << arc;
+    }
 
 	qp.drawEllipse(QRectF(ellipse_x, ellipse_y, ellipse_l, ellipse_h));
 	qp.restore();
@@ -565,7 +574,7 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parseArc(QDomElement &e, QPainter &qp) {
+bool CustomElement::parseArc(QDomElement &e, QPainter &qp, bool addtolist) {
 	// verifie la presence des attributs obligatoires
 	qreal arc_x, arc_y, arc_l, arc_h, arc_s, arc_a;
 	if (!QET::attributeIsAReal(e, QString("x"),       &arc_x))  return(false);
@@ -578,14 +587,16 @@
 	qp.save();
 	setPainterStyle(e, qp);
 
-	QVector<qreal> *arc = new QVector<qreal>;
-	arc -> push_back(arc_x);
-	arc -> push_back(arc_y);
-	arc -> push_back(arc_l);
-	arc -> push_back(arc_h);
-	arc -> push_back(arc_s);
-	arc -> push_back(arc_a);
-	m_arcs << arc;
+    if (addtolist){
+        QVector<qreal> *arc = new QVector<qreal>;
+        arc -> push_back(arc_x);
+        arc -> push_back(arc_y);
+        arc -> push_back(arc_l);
+        arc -> push_back(arc_h);
+        arc -> push_back(arc_s);
+        arc -> push_back(arc_a);
+        m_arcs << arc;
+    }
 
 	qp.drawArc(QRectF(arc_x, arc_y, arc_l, arc_h), (int)(arc_s * 16), (int)(arc_a * 16));
 	qp.restore();
@@ -603,7 +614,7 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parsePolygon(QDomElement &e, QPainter &qp) {
+bool CustomElement::parsePolygon(QDomElement &e, QPainter &qp, bool addtolist) {
 	int i = 1;
 	while(true) {
 		if (QET::attributeIsAReal(e, QString("x%1").arg(i)) && QET::attributeIsAReal(e, QString("y%1").arg(i))) ++ i;
@@ -630,11 +641,12 @@
 		// insert first point at the end again for DXF export.
 		points.push_back(points[0]);
 	}
+    if (addtolist){
+        // Add to list of polygons.
+        QVector<QPointF> *poly = new QVector<QPointF>(points);
+        m_polygons << poly;
+    }
 
-	// Add to list of polygons.
-	QVector<QPointF> *poly = new QVector<QPointF>(points);
-	m_polygons << poly;
-
 	qp.restore();
 	return(true);
 }
@@ -648,7 +660,7 @@
 	@param qp Le QPainter a utiliser pour dessiner l'element perso
 	@return true si l'analyse reussit, false sinon
 */
-bool CustomElement::parseText(QDomElement &e, QPainter &qp) {
+bool CustomElement::parseText(QDomElement &e, QPainter &qp, bool addtolist) {
 	qreal pos_x, pos_y;
 	int size;
 	if (
@@ -672,17 +684,19 @@
 	text_document.setDefaultFont(used_font);
 	text_document.setPlainText(e.attribute("text"));
 
-	//Add element to list of texts.
-	ElementTextItem *eti = new ElementTextItem(e.attribute("text"));
-	eti -> setFont(QETApp::diagramTextsFont(size));
-	eti -> setOriginalPos(QPointF(pos_x, pos_y));
-	eti -> setPos(pos_x, pos_y);
-	qreal original_rotation_angle = 0.0;
-	QET::attributeIsAReal(e, "rotation", &original_rotation_angle);
-	eti -> setOriginalRotationAngle(original_rotation_angle);
-	eti -> setRotationAngle(original_rotation_angle);
-	eti -> setFollowParentRotations(e.attribute("rotate") == "true");
-	m_texts << eti;
+    if (addtolist){
+        //Add element to list of texts.
+        ElementTextItem *eti = new ElementTextItem(e.attribute("text"));
+        eti -> setFont(QETApp::diagramTextsFont(size));
+        eti -> setOriginalPos(QPointF(pos_x, pos_y));
+        eti -> setPos(pos_x, pos_y);
+        qreal original_rotation_angle = 0.0;
+        QET::attributeIsAReal(e, "rotation", &original_rotation_angle);
+        eti -> setOriginalRotationAngle(original_rotation_angle);
+        eti -> setRotationAngle(original_rotation_angle);
+        eti -> setFollowParentRotations(e.attribute("rotate") == "true");
+        m_texts << eti;
+    }
 
 	// Se positionne aux coordonnees indiquees dans la description du texte
 	qp.setTransform(QTransform(), false);
Index: customelement.h
===================================================================
--- customelement.h	(revision 5253)
+++ customelement.h	(working copy)
@@ -80,14 +80,14 @@
 	
 	protected:
 		virtual bool buildFromXml(const QDomElement &, int * = nullptr);
-		virtual bool parseElement(QDomElement &, QPainter &);
-		virtual bool parseLine(QDomElement &, QPainter &);
-		virtual bool parseRect(QDomElement &, QPainter &);
-		virtual bool parseEllipse(QDomElement &, QPainter &);
-		virtual bool parseCircle(QDomElement &, QPainter &);
-		virtual bool parseArc(QDomElement &, QPainter &);
-		virtual bool parsePolygon(QDomElement &, QPainter &);
-		virtual bool parseText(QDomElement &, QPainter &);
+        virtual bool parseElement(QDomElement &, QPainter &, bool addtolist = true);
+        virtual bool parseLine(QDomElement &, QPainter &, bool addtolist = true);
+        virtual bool parseRect(QDomElement &, QPainter &, bool addtolist = true);
+        virtual bool parseEllipse(QDomElement &, QPainter &, bool addtolist = true);
+        virtual bool parseCircle(QDomElement &, QPainter &, bool addtolist = true);
+        virtual bool parseArc(QDomElement &, QPainter &, bool addtolist = true);
+        virtual bool parsePolygon(QDomElement &, QPainter &, bool addtolist = true);
+        virtual bool parseText(QDomElement &, QPainter &, bool addtolist = true);
 		virtual bool parseInput(QDomElement &);
 		virtual DynamicElementTextItem *parseDynamicText(QDomElement &);
 		virtual Terminal *parseTerminal(QDomElement &);
qetgraphicsitem.patch (12,180 bytes)   

gabberworld

2018-03-05 17:28

reporter   ~0000321

by the way for me it seems low_zoom_drawing is useless as it seems for me that it never switch for that at me. maybe it works in other OS but not here

void CustomElement::paint(QPainter *qp, const QStyleOptionGraphicsItem *options) {
    if (options && options -> levelOfDetail < 1.0) {
        low_zoom_drawing.play(qp);
    } else {
        drawing.play(qp);
    }
}

that options->levelOfDetail is always 1 at me if zoomed in or zoomed out

scorpio810

2018-03-08 19:23

administrator   ~0000322

This commit not fix it?
Revision: 5250
Author: blacksun
Date: 2018-03-01 19:45:40 +0100 (Thu, 01 Mar 2018)
Log Message:
-----------
Fix bug N°153

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2018-03-01 18:38:37 UTC (rev 5249)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2018-03-01 18:45:40 UTC (rev 5250)
@@ -191,7 +191,7 @@
                 {
                     ++ parsed_elements_count;
                     QString current_tag = qde.tagName();
-					if (current_tag != "terminal" && current_tag != "input" && current_tag != "dynamic_text")
+					if (current_tag != "terminal" && current_tag != "input" && current_tag != DynamicElementTextItem::xmlTaggName())
                     {
                         forbid_antialiasing = true;
                         parseElement(qde, low_zoom_qp);

gabberworld

2018-03-08 23:45

reporter   ~0000323

no, i added qetgraphicsitem.patch what fill fix that

Issue History

Date Modified Username Field Change
2018-02-06 16:30 gabberworld New Issue
2018-02-06 16:30 gabberworld File Added: exportdialog.cpp.patch
2018-02-06 20:28 gabberworld Note Added: 0000296
2018-02-11 16:26 gabberworld File Added: dxf.color.patch
2018-02-11 16:26 gabberworld Note Added: 0000299
2018-02-11 17:15 scorpio810 Note Added: 0000300
2018-03-01 07:58 scorpio810 Status new => resolved
2018-03-01 07:58 scorpio810 Resolution open => fixed
2018-03-01 07:58 scorpio810 Fixed in Version => SVN/trunk
2018-03-01 10:01 gabberworld Status resolved => feedback
2018-03-01 10:01 gabberworld Resolution fixed => reopened
2018-03-01 10:01 gabberworld Note Added: 0000316
2018-03-01 19:49 black_sun Assigned To => black_sun_2012
2018-03-01 19:49 black_sun Status feedback => resolved
2018-03-01 20:15 scorpio810 Note Added: 0000317
2018-03-01 23:22 gabberworld Status resolved => feedback
2018-03-01 23:22 gabberworld Note Added: 0000318
2018-03-01 23:25 gabberworld Note Added: 0000319
2018-03-01 23:25 gabberworld Status feedback => assigned
2018-03-04 10:49 gabberworld File Added: qetgraphicsitem.patch
2018-03-04 10:49 gabberworld Note Added: 0000320
2018-03-05 17:28 gabberworld Note Added: 0000321
2018-03-08 19:23 scorpio810 Note Added: 0000322
2018-03-08 23:45 gabberworld Note Added: 0000323
2021-02-15 00:48 user245 Category Diagram Editor => website