[qet] qet/qet: [4752] Probably fix the fucking crash of ghost conductor. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4752
Author: blacksun
Date: 2016-10-20 14:35:44 +0200 (Thu, 20 Oct 2016)
Log Message:
-----------
Probably fix the fucking crash of ghost conductor.
Modified Paths:
--------------
trunk/sources/qetgraphicsitem/conductor.cpp
trunk/sources/qetgraphicsitem/qetshapeitem.cpp
Modified: trunk/sources/qetgraphicsitem/conductor.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/conductor.cpp 2016-10-19 19:41:14 UTC (rev 4751)
+++ trunk/sources/qetgraphicsitem/conductor.cpp 2016-10-20 12:35:44 UTC (rev 4752)
@@ -501,6 +501,7 @@
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
}
}
+
qp -> restore();
}
@@ -723,9 +724,21 @@
QPainterPath shape_(pps.createStroke(path()));
- if (isSelected())
- foreach (QRectF rect, m_handler.handlerRect(handlerPoints()))
- shape_.addRect(rect);
+ /**
+ Add handle rect to path, occur a weird bug.
+ when the conductor is removed from the scene he continue to be painted in the scene and make artefact.
+ If we save (exactly when we clear the undo stack of project when saving), Qet crash,
+ Don't add the handle rect to the path seem to work well.
+ More information here :
+ https://qelectrotech.org/bugtracker/view.php?id=107
+ https://qelectrotech.org/forum/viewtopic.php?pid=5619#p5619
+ https://qelectrotech.org/forum/viewtopic.php?pid=5067#p5067
+ **/
+// if (isSelected()) {
+// foreach (QRectF rect, m_handler.handlerRect(handlerPoints())) {
+// shape_.addRect(rect);
+// }
+// }
return shape_;
}
Modified: trunk/sources/qetgraphicsitem/qetshapeitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/qetshapeitem.cpp 2016-10-19 19:41:14 UTC (rev 4751)
+++ trunk/sources/qetgraphicsitem/qetshapeitem.cpp 2016-10-20 12:35:44 UTC (rev 4752)
@@ -246,22 +246,26 @@
pps.setJoinStyle(Qt::RoundJoin);
path = pps.createStroke(path);
- if (isSelected())
- {
- QVector <QPointF> vector;
+ /**
+ Code below is commented to avoid weird bug see : QPainterPath Conductor::shape() const
+ for more information
+ **/
+// if (isSelected())
+// {
+// QVector <QPointF> vector;
- if (m_shapeType == Line)
- vector << m_P1 << m_P2;
- else if (m_shapeType == Rectangle || m_shapeType == Ellipse) {
- QRectF rect (m_P1, m_P2);
- vector << rect.topLeft() << rect.topRight() << rect.bottomRight() << rect.bottomLeft();
- }
- else
- vector = m_polygon;
+// if (m_shapeType == Line)
+// vector << m_P1 << m_P2;
+// else if (m_shapeType == Rectangle || m_shapeType == Ellipse) {
+// QRectF rect (m_P1, m_P2);
+// vector << rect.topLeft() << rect.topRight() << rect.bottomRight() << rect.bottomLeft();
+// }
+// else
+// vector = m_polygon;
- foreach(QRectF r, m_handler.handlerRect(vector))
- path.addRect(r);
- }
+// foreach(QRectF r, m_handler.handlerRect(vector))
+// path.addRect(r);
+// }
return (path);
}