void QgsLayerPropertiesWidget::updateSymbolLayerWidget( QgsSymbolLayerV2* layer ) { if ( stackedWidget->currentWidget() != pageDummy ) { // stop updating from the original widget disconnect( stackedWidget->currentWidget(), SIGNAL( changed() ), this, SLOT( emitSignalChanged() ) ); stackedWidget->removeWidget( stackedWidget->currentWidget() ); } QgsSymbolLayerV2Registry* pReg = QgsSymbolLayerV2Registry::instance(); QString layerType = layer->layerType(); QgsSymbolLayerV2AbstractMetadata* am = pReg->symbolLayerMetadata( layerType ); if ( am ) { QgsSymbolLayerV2Widget* w = am->createSymbolLayerWidget( mVectorLayer ); if ( w ) { w->setSymbolLayer( layer ); stackedWidget->addWidget( w ); stackedWidget->setCurrentWidget( w ); // start recieving updates from widget connect( w , SIGNAL( changed() ), this, SLOT( emitSignalChanged() ) ); return; } } // When anything is not right stackedWidget->setCurrentWidget( pageDummy ); }
void QgsSymbolV2PropertiesDialog::loadPropertyWidgets() { QgsSymbolLayerV2Registry* pReg = QgsSymbolLayerV2Registry::instance(); QStringList layerTypes = pReg->symbolLayersForType( mSymbol->type() ); // also load line symbol layers for fill symbols if ( mSymbol->type() == QgsSymbolV2::Fill ) layerTypes += pReg->symbolLayersForType( QgsSymbolV2::Line ); for ( int i = 0; i < layerTypes.count(); i++ ) { QString layerType = layerTypes[i]; QgsSymbolLayerV2AbstractMetadata* am = pReg->symbolLayerMetadata( layerType ); if ( am == NULL ) // check whether the metadata is assigned continue; QgsSymbolLayerV2Widget* w = am->createSymbolLayerWidget(); if ( w == NULL ) // check whether the function returns correct widget continue; mWidgets[layerType] = w; stackedWidget->addWidget( w ); } }