QTfrontend/mapContainer.cpp
changeset 1333 b0b0510eb82d
parent 1318 18da1c5e960d
child 1348 0eb0b3a955b8
--- a/QTfrontend/mapContainer.cpp	Thu Oct 09 13:57:18 2008 +0000
+++ b/QTfrontend/mapContainer.cpp	Thu Oct 09 15:54:09 2008 +0000
@@ -35,7 +35,9 @@
 #include "igbox.h"
 
 HWMapContainer::HWMapContainer(QWidget * parent) :
-  QWidget(parent), mainLayout(this)
+	QWidget(parent),
+	mainLayout(this),
+	pMap(0)
 {
 #if QT_VERSION >= 0x040300
   mainLayout.setContentsMargins(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
@@ -111,12 +113,14 @@
   imageButt->setIcon(pxres);
   imageButt->setIconSize(QSize(256, 128));
   chooseMap->setCurrentIndex(0);
+  pMap = 0;
 }
 
 void HWMapContainer::mapChanged(int index)
 {
   if(!index) {
     changeImage();
+    emit mapChanged("+rnd+");
     return;
   }
 
@@ -185,10 +189,18 @@
 
 void HWMapContainer::setMap(const QString & map)
 {
+	if(map == "+rnd+")
+	{
+		changeImage();
+		return;
+	}
+	
 	int id = chooseMap->findText(map);
-	if(id >= 0) {
+	if(id > 0) {
 		chooseMap->setCurrentIndex(id);
 		loadMap(id);
+		if (pMap)
+			disconnect(pMap, 0, this, SLOT(setImage(const QImage)));
 	}
 }