QTfrontend/mapContainer.cpp
changeset 1214 090f94cd663e
parent 1211 94c4f20abdda
child 1215 0c1c294c0f7e
equal deleted inserted replaced
1213:173c79113dfe 1214:090f94cd663e
    42                 QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
    42                 QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
    43                 QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
    43                 QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
    44 #endif
    44 #endif
    45   imageButt = new QPushButton(this);
    45   imageButt = new QPushButton(this);
    46   imageButt->setObjectName("imageButt");
    46   imageButt->setObjectName("imageButt");
    47   imageButt->setFixedSize(256 + 8, 128 + 8);
    47   imageButt->setFixedSize(256 + 6, 128 + 6);
    48   imageButt->setFlat(true);
    48   imageButt->setFlat(true);
    49   imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
    49   imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
    50   mainLayout.addWidget(imageButt, 0, 0, 1, 2);
    50   mainLayout.addWidget(imageButt, 0, 0, 1, 2);
    51   connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomSeed()));
    51   connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomSeed()));
    52   setRandomSeed();
    52   setRandomSeed();
    78 	}
    78 	}
    79 	
    79 	
    80 	gbTLayout->addWidget(lwThemes);
    80 	gbTLayout->addWidget(lwThemes);
    81 	lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
    81 	lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
    82 	
    82 	
    83 
       
    84   mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
    83   mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
    85 }
    84 }
    86 
    85 
    87 void HWMapContainer::setImage(const QImage newImage)
    86 void HWMapContainer::setImage(const QImage newImage)
    88 {
    87 {
   134   }
   133   }
   135 }
   134 }
   136 
   135 
   137 void HWMapContainer::changeImage()
   136 void HWMapContainer::changeImage()
   138 {
   137 {
   139   pMap = new HWMap();
   138 	pMap = new HWMap();
   140   connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
   139 	connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
   141   pMap->getImage(m_seed.toStdString());
   140 	pMap->getImage(m_seed.toStdString());
   142   theme = (Themes->size() > 0) ? Themes->at(rand() % Themes->size()) : "steel";
   141 
       
   142 	if(!Themes->size()) return;
       
   143 	quint32 themeNum = rand() % Themes->size();
       
   144 	theme = Themes->at(themeNum);
       
   145 	lwThemes->setCurrentRow(themeNum);
   143 }
   146 }
   144 
   147 
   145 QString HWMapContainer::getCurrentSeed() const
   148 QString HWMapContainer::getCurrentSeed() const
   146 {
   149 {
   147   return m_seed;
   150   return m_seed;