QTfrontend/drawmapscene.cpp
changeset 5906 ed9676dc8cb4
parent 5858 1f4a8cf9efcb
child 6616 f77bb02b669f
equal deleted inserted replaced
5713:190d6bb075c5 5906:ed9676dc8cb4
   106         removeItem(items().first());
   106         removeItem(items().first());
   107         paths.removeFirst();
   107         paths.removeFirst();
   108 
   108 
   109         emit pathChanged();
   109         emit pathChanged();
   110     }
   110     }
       
   111     else if(oldItems.size())
       
   112     {
       
   113         while(oldItems.size())
       
   114             addItem(oldItems.takeFirst());
       
   115         paths = oldPaths;
       
   116 
       
   117         emit pathChanged();
       
   118     }
   111 }
   119 }
   112 
   120 
   113 void DrawMapScene::clearMap()
   121 void DrawMapScene::clearMap()
   114 {
   122 {
   115     clear();
   123     // don't clear if already cleared
       
   124     if(!items().size())
       
   125         return;
       
   126 
       
   127     oldItems.clear();
       
   128 
       
   129     // do this since clear() would _destroy_ all items
       
   130     while(items().size()) {
       
   131         oldItems.push_front(items().first());
       
   132         removeItem(items().first());
       
   133     }
       
   134 
       
   135     oldPaths = paths;
       
   136 
   116     paths.clear();
   137     paths.clear();
   117 
   138 
   118     emit pathChanged();
   139     emit pathChanged();
   119 }
   140 }
   120 
   141 
   144     return b;
   165     return b;
   145 }
   166 }
   146 
   167 
   147 void DrawMapScene::decode(QByteArray data)
   168 void DrawMapScene::decode(QByteArray data)
   148 {
   169 {
       
   170     oldItems.clear();
       
   171     oldPaths.clear();
   149     clear();
   172     clear();
   150     paths.clear();
   173     paths.clear();
   151 
   174 
   152     QList<QPoint> points;
   175     QList<QPoint> points;
   153 
   176