void QgsSymbolV2PropertiesDialog::updateSymbolLayerWidget( QgsSymbolLayerV2* layer ) { QString layerType = layer->layerType(); // stop updating from the original widget if ( stackedWidget->currentWidget() != pageDummy ) disconnect( stackedWidget->currentWidget(), SIGNAL( changed() ), this, SLOT( updateLayerPreview() ) ); // update active properties widget if ( mWidgets.contains( layerType ) ) { stackedWidget->setCurrentWidget( mWidgets[layerType] ); mWidgets[layerType]->setSymbolLayer( layer ); // start recieving updates from widget connect( mWidgets[layerType], SIGNAL( changed() ), this, SLOT( updateLayerPreview() ) ); } else { // use dummy widget instead stackedWidget->setCurrentWidget( pageDummy ); } }
void QgsSymbolV2SelectorDialog::layerChanged() { updateUi(); SymbolLayerItem *currentItem = static_cast<SymbolLayerItem*>( model->itemFromIndex( layersTree->currentIndex() ) ); if ( currentItem == NULL ) return; if ( currentItem->isLayer() ) { SymbolLayerItem *parent = static_cast<SymbolLayerItem*>( currentItem->parent() ); mDataDefineRestorer.reset( new DataDefinedRestorer( parent->symbol(), currentItem->layer() ) ); QgsLayerPropertiesWidget *layerProp = new QgsLayerPropertiesWidget( currentItem->layer(), parent->symbol(), mVectorLayer ); layerProp->setExpressionContext( mPresetExpressionContext.data() ); layerProp->setMapCanvas( mMapCanvas ); setWidget( layerProp ); connect( layerProp, SIGNAL( changed() ), mDataDefineRestorer.data(), SLOT( restore() ) ); connect( layerProp, SIGNAL( changed() ), this, SLOT( updateLayerPreview() ) ); // This connection when layer type is changed connect( layerProp, SIGNAL( changeLayer( QgsSymbolLayerV2* ) ), this, SLOT( changeLayer( QgsSymbolLayerV2* ) ) ); }
void QgsSymbolSelectorWidget::layerChanged() { updateUi(); SymbolLayerItem *currentItem = static_cast<SymbolLayerItem*>( model->itemFromIndex( layersTree->currentIndex() ) ); if ( !currentItem ) return; if ( currentItem->isLayer() ) { SymbolLayerItem *parent = static_cast<SymbolLayerItem*>( currentItem->parent() ); mDataDefineRestorer.reset( new DataDefinedRestorer( parent->symbol(), currentItem->layer() ) ); QgsLayerPropertiesWidget *layerProp = new QgsLayerPropertiesWidget( currentItem->layer(), parent->symbol(), mVectorLayer ); layerProp->setDockMode( this->dockMode() ); layerProp->setContext( mContext ); setWidget( layerProp ); connect( layerProp, SIGNAL( changed() ), mDataDefineRestorer.data(), SLOT( restore() ) ); connect( layerProp, SIGNAL( changed() ), this, SLOT( updateLayerPreview() ) ); // This connection when layer type is changed connect( layerProp, SIGNAL( changeLayer( QgsSymbolLayer* ) ), this, SLOT( changeLayer( QgsSymbolLayer* ) ) ); connectChildPanel( layerProp ); }