40 mRenderer.reset(
nullptr );
41 QGridLayout *layout =
new QGridLayout(
this );
42 QLabel *label =
new QLabel( tr(
"The merged feature renderer only applies to line and polygon layers. \n"
43 "'%1' is not a line or polygon layer and then cannot be displayed" )
44 .arg( layer->
name() ),
this );
45 this->setLayout( layout );
46 layout->addWidget( label );
50 connect( mRendererComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged );
66 int currentEmbeddedIdx = 0;
69 QStringList::const_iterator it = rendererList.constBegin();
71 mRendererComboBox->blockSignals(
true );
72 for ( ; it != rendererList.constEnd(); ++it, ++idx )
74 if ( *it != QLatin1String(
"mergedFeatureRenderer" )
75 && *it != QLatin1String(
"invertedPolygonRenderer" ) )
80 if ( embeddedRenderer && embeddedRenderer->
type() == m->
name() )
83 currentEmbeddedIdx = idx;
87 mRendererComboBox->blockSignals(
false );
89 const int oldIdx = mRendererComboBox->currentIndex();
90 mRendererComboBox->setCurrentIndex( currentEmbeddedIdx );
91 if ( oldIdx == currentEmbeddedIdx )
94 mRendererComboBox_currentIndexChanged( currentEmbeddedIdx );
102 if ( mRenderer && mEmbeddedRendererWidget )
105 if ( embeddedRenderer )
107 mRenderer->setEmbeddedRenderer( embeddedRenderer->
clone() );
110 return mRenderer.get();
116 if ( mEmbeddedRendererWidget )
117 mEmbeddedRendererWidget->setContext(
context );
123 if ( mEmbeddedRendererWidget )
124 mEmbeddedRendererWidget->setDockMode(
dockMode );
127void QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
129 const QString rendererId = mRendererComboBox->itemData( index ).toString();
133 const std::unique_ptr< QgsFeatureRenderer > oldRenderer( mRenderer->embeddedRenderer()->clone() );
136 mEmbeddedRendererWidget->setContext(
mContext );
137 mEmbeddedRendererWidget->disableSymbolLevels();
138 mEmbeddedRendererWidget->setDockMode( this->
dockMode() );
141 if ( layout()->count() > 2 )
144 layout()->takeAt( 2 );
146 layout()->addWidget( mEmbeddedRendererWidget.get() );
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
Abstract base class for all 2D vector feature renderers.
static QgsFeatureRenderer * defaultRenderer(Qgis::GeometryType geomType)
Returns a new renderer - used by default in vector layers.
void copyRendererData(QgsFeatureRenderer *destRenderer) const
Clones generic renderer data to another renderer.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
QgsMergedFeatureRenderer is a polygon or line-only feature renderer used to renderer a set of feature...
static QgsMergedFeatureRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
Creates a QgsMergedFeatureRenderer by a conversion from an existing renderer.
QStringList renderersList(QgsRendererAbstractMetadata::LayerTypes layerTypes=QgsRendererAbstractMetadata::All) const
Returns a list of available renderers.
QgsRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE Qgis::WkbType wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...