Fix incorrect preview when selecting image map the first time in session
authorWuzzy <Wuzzy2@mail.ru>
Tue, 20 Mar 2018 02:24:47 +0100
changeset 13258 66dd7b5f7d33
parent 13257 7d7eb27dab31
child 13259 e13777374583
Fix incorrect preview when selecting image map the first time in session
QTfrontend/ui/widget/mapContainer.cpp
--- a/QTfrontend/ui/widget/mapContainer.cpp	Mon Mar 19 18:58:49 2018 +0100
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Tue Mar 20 02:24:47 2018 +0100
@@ -399,7 +399,7 @@
 void HWMapContainer::askForGeneratedPreview()
 {
     pMap = new HWMap(this);
-    connect(pMap, SIGNAL(ImageReceived(QPixmap)), this, SLOT(setImage(QPixmap)));
+    connect(pMap, SIGNAL(ImageReceived(QPixmap)), this, SLOT(setImage(const QPixmap)));
     connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
     connect(pMap, SIGNAL(destroyed(QObject *)), this, SLOT(onPreviewMapDestroyed(QObject *)));
     pMap->getImage(m_seed,
@@ -563,7 +563,7 @@
         if (m_mapInfo.type != MapModel::StaticMap && m_mapInfo.type != MapModel::MissionMap)
         {
             m_mapInfo.type = MapModel::StaticMap;
-            changeMapType(MapModel::StaticMap, QModelIndex());
+            changeMapType(m_mapInfo.type, QModelIndex());
         }
         updatePreview();
     }
@@ -1112,9 +1112,18 @@
 {
     QListView * mapList;
 
-    if (type == 0)      mapList = staticMapList;
-    else if (type == 1) mapList = missionMapList;
-    else                return;
+    if (type == 0)
+    {
+        mapList = staticMapList;
+        m_mapInfo.type = MapModel::StaticMap;
+    }
+    else if (type == 1)
+    {
+        mapList = missionMapList;
+        m_mapInfo.type = MapModel::MissionMap;
+    }
+    else
+        return;
 
     // Make sure it is a valid index
     if (!map.isValid())