Draw map page: Fix pen size being changed after loading a map
authorWuzzy <Wuzzy2@mail.ru>
Sat, 17 Mar 2018 15:51:45 +0100
changeset 13241 ef1393c6bd12
parent 13240 9f5023a5f9e1
child 13242 0171519e2f13
Draw map page: Fix pen size being changed after loading a map
QTfrontend/drawmapscene.cpp
--- a/QTfrontend/drawmapscene.cpp	Sat Mar 17 04:37:13 2018 +0100
+++ b/QTfrontend/drawmapscene.cpp	Sat Mar 17 15:51:45 2018 +0100
@@ -336,8 +336,12 @@
 {
     hideCursor();
 
+    // Remember erasing mode
     bool erasing = m_isErasing;
 
+    // Use seperate for decoding the map, don't mess with the user pen
+    QPen load_pen = QPen(m_pen);
+
     oldItems.clear();
     oldPaths.clear();
     clear();
@@ -363,7 +367,7 @@
 
             if(params.points.size())
             {
-                addPath(pointsToPath(params.points), m_pen);
+                addPath(pointsToPath(params.points), load_pen);
 
                 paths.prepend(params);
 
@@ -371,12 +375,12 @@
             }
 
             quint8 penWidth = flags & 0x3f;
-            m_pen.setWidth(deserializePenWidth(penWidth));
+            load_pen.setWidth(deserializePenWidth(penWidth));
             params.erasing = flags & 0x40;
             if(params.erasing)
-                m_pen.setBrush(m_eraser);
+                load_pen.setBrush(m_eraser);
             else
-                m_pen.setBrush(m_brush);
+                load_pen.setBrush(m_brush);
             params.width = penWidth;
         } else
             if(isSpecial)
@@ -399,12 +403,13 @@
 
     if(params.points.size())
     {
-        addPath(pointsToPath(params.points), m_pen);
+        addPath(pointsToPath(params.points), load_pen);
         paths.prepend(params);
     }
 
     emit pathChanged();
 
+    // Restore erasing mode
     setErasing(erasing);
 }