void QgsPointDisplacementRendererWidget::on_mRendererSettingsButton_clicked() { if ( !mRenderer ) return; QgsRendererAbstractMetadata* m = QgsRendererRegistry::instance()->rendererMetadata( mRenderer->embeddedRenderer()->type() ); if ( m ) { QgsRendererWidget* w = m->createRendererWidget( mLayer, mStyle, mRenderer->embeddedRenderer()->clone() ); w->setPanelTitle( tr( "Renderer settings" ) ); QgsSymbolWidgetContext context = mContext; QgsExpressionContextScope scope; scope.addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_CLUSTER_COLOR, "", true ) ); scope.addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_CLUSTER_SIZE, 0, true ) ); QList< QgsExpressionContextScope > scopes = context.additionalExpressionContextScopes(); scopes << scope; context.setAdditionalExpressionContextScopes( scopes ); w->setContext( context ); connect( w, SIGNAL( widgetChanged() ), this, SLOT( updateRendererFromWidget() ) ); openPanel( w ); } }
void QgsPointDisplacementRendererWidget::updateRendererFromWidget() { QgsRendererWidget* w = qobject_cast<QgsRendererWidget*>( sender() ); if ( !w ) return; mRenderer->setEmbeddedRenderer( w->renderer()->clone() ); emit widgetChanged(); }
void QgsPointDisplacementRendererWidget::on_mRendererComboBox_currentIndexChanged( int index ) { QString rendererId = mRendererComboBox->itemData( index ).toString(); QgsRendererAbstractMetadata* m = QgsRendererRegistry::instance()->rendererMetadata( rendererId ); if ( m ) { // unfortunately renderer conversion is only available through the creation of a widget... QgsRendererWidget* tempRenderWidget = m->createRendererWidget( mLayer, mStyle, mRenderer->embeddedRenderer()->clone() ); mRenderer->setEmbeddedRenderer( tempRenderWidget->renderer()->clone() ); delete tempRenderWidget; emit widgetChanged(); } }
void QgsPointClusterRendererWidget::mRendererSettingsButton_clicked() { if ( !mRenderer ) return; QgsRendererAbstractMetadata *m = QgsApplication::rendererRegistry()->rendererMetadata( mRenderer->embeddedRenderer()->type() ); if ( m ) { QgsRendererWidget *w = m->createRendererWidget( mLayer, mStyle, mRenderer->embeddedRenderer()->clone() ); w->setPanelTitle( tr( "Renderer Settings" ) ); QgsExpressionContextScope scope; scope.addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_CLUSTER_COLOR, "", true ) ); scope.addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_CLUSTER_SIZE, 0, true ) ); QList< QgsExpressionContextScope > scopes = mContext.additionalExpressionContextScopes(); scopes << scope; QgsSymbolWidgetContext context = mContext; context.setAdditionalExpressionContextScopes( scopes ); w->setContext( context ); connect( w, &QgsPanelWidget::widgetChanged, this, &QgsPointClusterRendererWidget::updateRendererFromWidget ); w->setDockMode( this->dockMode() ); openPanel( w ); } }