Element editor : finish the creation of polyline with the last point at the same position of the first point, close the polyline.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5869 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun 2019-05-18 19:49:27 +00:00
parent 3f9685832d
commit 28cceca3c5

View File

@ -110,7 +110,12 @@ bool ESEventAddPolygon::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
if (m_polygon)
{
m_polygon->removeLastPoint();
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Polygone"), m_scene, m_polygon));
if (m_polygon->polygon().first() == m_polygon->polygon().last())
{
m_polygon->removeLastPoint();
m_polygon->setClosed(true);
}
m_scene->undoStack().push(new AddPartCommand(QObject::tr("Polygone"), m_scene, m_polygon));
//Set m_polygon to nullptr for create new polygon at next mouse press
m_polygon = nullptr;