QTfrontend/drawmapscene.cpp
changeset 5858 1f4a8cf9efcb
parent 5108 b7483e29ea8c
child 6616 f77bb02b669f
--- a/QTfrontend/drawmapscene.cpp	Sun Sep 11 11:09:28 2011 -0400
+++ b/QTfrontend/drawmapscene.cpp	Sun Sep 11 18:19:05 2011 +0200
@@ -108,11 +108,32 @@
 
         emit pathChanged();
     }
+    else if(oldItems.size())
+    {
+        while(oldItems.size())
+            addItem(oldItems.takeFirst());
+        paths = oldPaths;
+
+        emit pathChanged();
+    }
 }
 
 void DrawMapScene::clearMap()
 {
-    clear();
+    // don't clear if already cleared
+    if(!items().size())
+        return;
+
+    oldItems.clear();
+
+    // do this since clear() would _destroy_ all items
+    while(items().size()) {
+        oldItems.push_front(items().first());
+        removeItem(items().first());
+    }
+
+    oldPaths = paths;
+
     paths.clear();
 
     emit pathChanged();
@@ -146,6 +167,8 @@
 
 void DrawMapScene::decode(QByteArray data)
 {
+    oldItems.clear();
+    oldPaths.clear();
     clear();
     paths.clear();