44 mRenderer.reset(
nullptr );
45 QGridLayout *layout =
new QGridLayout(
this );
46 QLabel *label =
new QLabel( tr(
"The merged feature renderer only applies to line and polygon layers. \n"
47 "'%1' is not a line or polygon layer and then cannot be displayed" )
48 .arg( layer->
name() ),
this );
49 this->setLayout( layout );
50 layout->addWidget( label );
54 connect( mRendererComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged );
70 int currentEmbeddedIdx = 0;
73 QStringList::const_iterator it = rendererList.constBegin();
75 mRendererComboBox->blockSignals(
true );
76 for ( ; it != rendererList.constEnd(); ++it, ++idx )
78 if ( *it != QLatin1String(
"mergedFeatureRenderer" )
79 && *it != QLatin1String(
"invertedPolygonRenderer" ) )
84 if ( embeddedRenderer && embeddedRenderer->
type() == m->
name() )
87 currentEmbeddedIdx = idx;
91 mRendererComboBox->blockSignals(
false );
93 const int oldIdx = mRendererComboBox->currentIndex();
94 mRendererComboBox->setCurrentIndex( currentEmbeddedIdx );
95 if ( oldIdx == currentEmbeddedIdx )
98 mRendererComboBox_currentIndexChanged( currentEmbeddedIdx );
106 if ( mRenderer && mEmbeddedRendererWidget )
109 if ( embeddedRenderer )
111 mRenderer->setEmbeddedRenderer( embeddedRenderer->
clone() );
114 return mRenderer.get();
120 if ( mEmbeddedRendererWidget )
121 mEmbeddedRendererWidget->setContext(
context );
127 if ( mEmbeddedRendererWidget )
128 mEmbeddedRendererWidget->setDockMode(
dockMode );
131void QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
133 const QString rendererId = mRendererComboBox->itemData( index ).toString();
137 const std::unique_ptr< QgsFeatureRenderer > oldRenderer( mRenderer->embeddedRenderer()->clone() );
140 mEmbeddedRendererWidget->setContext(
mContext );
141 mEmbeddedRendererWidget->disableSymbolLevels();
142 mEmbeddedRendererWidget->setDockMode( this->
dockMode() );
145 if ( layout()->count() > 2 )
148 layout()->takeAt( 2 );
150 layout()->addWidget( mEmbeddedRendererWidget.get() );
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
static QgsFeatureRenderer * defaultRenderer(QgsWkbTypes::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 QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
static GeometryType geometryType(Type type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.