QTfrontend/ui/widget/mapContainer.cpp
changeset 6937 7f77fa908a4e
parent 6933 78d194a30520
child 6938 217ed62e872c
equal deleted inserted replaced
6936:8af2bf10ee62 6937:7f77fa908a4e
   120     gbTLayout->setContentsMargins(0, 0, 0 ,0);
   120     gbTLayout->setContentsMargins(0, 0, 0 ,0);
   121     gbTLayout->setSpacing(0);
   121     gbTLayout->setSpacing(0);
   122     lvThemes = new QListView(mapWidget);
   122     lvThemes = new QListView(mapWidget);
   123     lvThemes->setMinimumHeight(30);
   123     lvThemes->setMinimumHeight(30);
   124     lvThemes->setFixedWidth(140);
   124     lvThemes->setFixedWidth(140);
   125     lvThemes->setModel(themesModel);
   125     m_themeModel = DataManager::instance().themeModel();
       
   126     lvThemes->setModel(m_themeModel);
   126     lvThemes->setIconSize(QSize(16, 16));
   127     lvThemes->setIconSize(QSize(16, 16));
   127     lvThemes->setEditTriggers(QListView::NoEditTriggers);
   128     lvThemes->setEditTriggers(QListView::NoEditTriggers);
   128 
   129 
   129     connect(lvThemes->selectionModel(), SIGNAL(currentRowChanged( const QModelIndex &, const QModelIndex &)), this, SLOT(themeSelected( const QModelIndex &, const QModelIndex &)));
   130     connect(lvThemes->selectionModel(), SIGNAL(currentRowChanged( const QModelIndex &, const QModelIndex &)), this, SLOT(themeSelected( const QModelIndex &, const QModelIndex &)));
   130 
   131 
   398     updatePreview();
   399     updatePreview();
   399 }
   400 }
   400 
   401 
   401 void HWMapContainer::setTheme(const QString & theme)
   402 void HWMapContainer::setTheme(const QString & theme)
   402 {
   403 {
   403     QModelIndexList mdl = themesModel->match(themesModel->index(0), Qt::DisplayRole, theme);
   404     QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), Qt::DisplayRole, theme);
   404 
   405 
   405     if(mdl.size())
   406     if(mdl.size())
   406         lvThemes->setCurrentIndex(mdl.at(0));
   407         lvThemes->setCurrentIndex(mdl.at(0));
   407 }
   408 }
   408 
   409 
   450         updatePreview();
   451         updatePreview();
   451 }
   452 }
   452 
   453 
   453 void HWMapContainer::setRandomTheme()
   454 void HWMapContainer::setRandomTheme()
   454 {
   455 {
   455     if(!themesModel->rowCount()) return;
   456     if(!m_themeModel->rowCount()) return;
   456     quint32 themeNum = rand() % themesModel->rowCount();
   457     quint32 themeNum = rand() % m_themeModel->rowCount();
   457     lvThemes->setCurrentIndex(themesModel->index(themeNum));
   458     lvThemes->setCurrentIndex(m_themeModel->index(themeNum));
   458 }
   459 }
   459 
   460 
   460 void HWMapContainer::intSetTemplateFilter(int filter)
   461 void HWMapContainer::intSetTemplateFilter(int filter)
   461 {
   462 {
   462     cbTemplateFilter->setCurrentIndex(filter);
   463     cbTemplateFilter->setCurrentIndex(filter);