From 28cceca3c597292e2b05816fb075fff51ef953c8 Mon Sep 17 00:00:00 2001 From: blacksun Date: Sat, 18 May 2019 19:49:27 +0000 Subject: [PATCH] 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 --- sources/editor/esevent/eseventaddpolygon.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sources/editor/esevent/eseventaddpolygon.cpp b/sources/editor/esevent/eseventaddpolygon.cpp index eaf3e7746..a241ffcf0 100644 --- a/sources/editor/esevent/eseventaddpolygon.cpp +++ b/sources/editor/esevent/eseventaddpolygon.cpp @@ -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;