Drawn map page: Enable antialiasing, turn eraser cursor red
authorWuzzy <Wuzzy2@mail.ru>
Wed, 14 Mar 2018 20:00:09 +0100
changeset 13204 9565569e410c
parent 13203 eaa494f0b19e
child 13205 c681492df36d
Drawn map page: Enable antialiasing, turn eraser cursor red
QTfrontend/drawmapscene.cpp
QTfrontend/ui/widget/drawmapwidget.h
--- a/QTfrontend/drawmapscene.cpp	Wed Mar 14 19:40:43 2018 +0100
+++ b/QTfrontend/drawmapscene.cpp	Wed Mar 14 20:00:09 2018 +0100
@@ -25,6 +25,10 @@
 
 #include "drawmapscene.h"
 
+#define DRAWN_MAP_COLOR_LAND (Qt::yellow)
+#define DRAWN_MAP_COLOR_CURSOR_PEN (Qt::green)
+#define DRAWN_MAP_COLOR_CURSOR_ERASER (Qt::red)
+
 template <class T> T sqr(const T & x)
 {
     return x*x;
@@ -32,8 +36,8 @@
 
 DrawMapScene::DrawMapScene(QObject *parent) :
     QGraphicsScene(parent),
-    m_pen(Qt::yellow),
-    m_brush(Qt::yellow),
+    m_pen(DRAWN_MAP_COLOR_LAND),
+    m_brush(DRAWN_MAP_COLOR_LAND),
     m_cursor(new QGraphicsEllipseItem(-5, -5, 5, 5))
 {
     setSceneRect(0, 0, 4096, 2048);
@@ -54,7 +58,7 @@
     m_currPath = 0;
 
     m_isCursorShown = false;
-    QPen cursorPen = QPen(Qt::green);
+    QPen cursorPen = QPen(DRAWN_MAP_COLOR_CURSOR_PEN);
     cursorPen.setJoinStyle(Qt::RoundJoin);
     cursorPen.setCapStyle(Qt::RoundCap);
     cursorPen.setWidth(m_pen.width());
@@ -271,10 +275,15 @@
 void DrawMapScene::setErasing(bool erasing)
 {
     m_isErasing = erasing;
-    if(erasing)
+    QPen cursorPen = m_cursor->pen();
+    if(erasing) {
         m_pen.setBrush(m_eraser);
-    else
+        cursorPen.setColor(DRAWN_MAP_COLOR_CURSOR_ERASER);
+    } else {
         m_pen.setBrush(m_brush);
+        cursorPen.setColor(DRAWN_MAP_COLOR_CURSOR_PEN);
+    }
+    m_cursor->setPen(cursorPen);
 }
 
 QByteArray DrawMapScene::encode()
--- a/QTfrontend/ui/widget/drawmapwidget.h	Wed Mar 14 19:40:43 2018 +0100
+++ b/QTfrontend/ui/widget/drawmapwidget.h	Wed Mar 14 20:00:09 2018 +0100
@@ -67,6 +67,7 @@
                 graphicsView = new DrawMapView(drawMapWidget);
                 graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
                 graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+                graphicsView->setRenderHint(QPainter::Antialiasing, true);
                 arLayout->addWidget(graphicsView);
 
                 retranslateUi(drawMapWidget);