Fix cursor circle being too large in drawn map editor
authorWuzzy <Wuzzy2@mail.ru>
Wed, 14 Mar 2018 19:40:43 +0100
changeset 13203 eaa494f0b19e
parent 13202 2fe85d497e0f
child 13204 9565569e410c
Fix cursor circle being too large in drawn map editor
QTfrontend/drawmapscene.cpp
--- a/QTfrontend/drawmapscene.cpp	Wed Mar 14 17:50:21 2018 +0100
+++ b/QTfrontend/drawmapscene.cpp	Wed Mar 14 19:40:43 2018 +0100
@@ -34,7 +34,7 @@
     QGraphicsScene(parent),
     m_pen(Qt::yellow),
     m_brush(Qt::yellow),
-    m_cursor(new QGraphicsEllipseItem(-0.5, -0.5, 1, 1))
+    m_cursor(new QGraphicsEllipseItem(-5, -5, 5, 5))
 {
     setSceneRect(0, 0, 4096, 2048);
 
@@ -54,9 +54,12 @@
     m_currPath = 0;
 
     m_isCursorShown = false;
-    m_cursor->setPen(QPen(Qt::green));
+    QPen cursorPen = QPen(Qt::green);
+    cursorPen.setJoinStyle(Qt::RoundJoin);
+    cursorPen.setCapStyle(Qt::RoundCap);
+    cursorPen.setWidth(m_pen.width());
+    m_cursor->setPen(cursorPen);
     m_cursor->setZValue(1);
-    m_cursor->setScale(m_pen.width());
 }
 
 void DrawMapScene::mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent)
@@ -185,7 +188,9 @@
     else if(wheelEvent->delta() < 0 && m_pen.width() >= 16)
         m_pen.setWidth(m_pen.width() - 10);
 
-    m_cursor->setScale(m_pen.width());
+    QPen cursorPen = m_cursor->pen();
+    cursorPen.setWidth(m_pen.width());
+    m_cursor->setPen(cursorPen);
 
     if(m_currPath)
     {