コード例 #1
0
void QgsPointDisplacementRendererWidget::on_mRendererComboBox_currentIndexChanged( int index )
{
    QString rendererId = mRendererComboBox->itemData( index ).toString();
    QgsRendererV2AbstractMetadata* m = QgsRendererV2Registry::instance()->rendererMetadata( rendererId );
    if ( m )
    {
        delete mEmbeddedRendererWidget;
        mEmbeddedRendererWidget = m->createRendererWidget( mLayer, mStyle, mRenderer->embeddedRenderer()->clone() );
    }
}
コード例 #2
0
void QgsInvertedPolygonRendererWidget::on_mRendererComboBox_currentIndexChanged( int index )
{
  QString rendererId = mRendererComboBox->itemData( index ).toString();
  QgsRendererV2AbstractMetadata* m = QgsRendererV2Registry::instance()->rendererMetadata( rendererId );
  if ( m )
  {
    mEmbeddedRendererWidget.reset( m->createRendererWidget( mLayer, mStyle, const_cast<QgsFeatureRendererV2*>( mRenderer->embeddedRenderer() )->clone() ) );

    if ( mLayout->count() > 2 )
    {
      // remove the current renderer widget
      mLayout->takeAt( 2 );
    }
    mLayout->addWidget( mEmbeddedRendererWidget.data() );
  }
}