16#include "moc_qgsmergedfeaturerendererwidget.cpp"
41 mRenderer.reset(
nullptr );
42 QGridLayout *layout =
new QGridLayout(
this );
43 QLabel *label =
new QLabel( tr(
"The merged feature renderer only applies to line and polygon layers. \n"
44 "'%1' is not a line or polygon layer and then cannot be displayed" )
45 .arg( layer->
name() ),
this );
46 this->setLayout( layout );
47 layout->addWidget( label );
51 connect( mRendererComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged );
67 int currentEmbeddedIdx = 0;
70 QStringList::const_iterator it = rendererList.constBegin();
72 mRendererComboBox->blockSignals(
true );
73 for ( ; it != rendererList.constEnd(); ++it, ++idx )
75 if ( *it != QLatin1String(
"mergedFeatureRenderer" )
76 && *it != QLatin1String(
"invertedPolygonRenderer" ) )
81 if ( embeddedRenderer && embeddedRenderer->
type() == m->
name() )
84 currentEmbeddedIdx = idx;
88 mRendererComboBox->blockSignals(
false );
90 const int oldIdx = mRendererComboBox->currentIndex();
91 mRendererComboBox->setCurrentIndex( currentEmbeddedIdx );
92 if ( oldIdx == currentEmbeddedIdx )
95 mRendererComboBox_currentIndexChanged( currentEmbeddedIdx );
103 if ( mRenderer && mEmbeddedRendererWidget )
106 if ( embeddedRenderer )
108 mRenderer->setEmbeddedRenderer( embeddedRenderer->
clone() );
111 return mRenderer.get();
117 if ( mEmbeddedRendererWidget )
118 mEmbeddedRendererWidget->setContext(
context );
124 if ( mEmbeddedRendererWidget )
125 mEmbeddedRendererWidget->setDockMode(
dockMode );
128void QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
130 const QString rendererId = mRendererComboBox->itemData( index ).toString();
134 const std::unique_ptr< QgsFeatureRenderer > oldRenderer( mRenderer->embeddedRenderer()->clone() );
137 mEmbeddedRendererWidget->setContext(
mContext );
138 mEmbeddedRendererWidget->disableSymbolLevels();
139 mEmbeddedRendererWidget->setDockMode( this->
dockMode() );
142 if ( layout()->count() > 2 )
145 layout()->takeAt( 2 );
147 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...