--- 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();
--- a/QTfrontend/drawmapscene.h Sun Sep 11 11:09:28 2011 -0400
+++ b/QTfrontend/drawmapscene.h Sun Sep 11 18:19:05 2011 +0200
@@ -48,6 +48,8 @@
QBrush m_brush;
QGraphicsPathItem * m_currPath;
Paths paths;
+ Paths oldPaths;
+ QList<QGraphicsItem *> oldItems;
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);