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 );
68 int currentEmbeddedIdx = 0;
71 QStringList::const_iterator it = rendererList.constBegin();
73 mRendererComboBox->blockSignals(
true );
74 for ( ; it != rendererList.constEnd(); ++it, ++idx )
76 if ( *it != QLatin1String(
"mergedFeatureRenderer" )
77 && *it != QLatin1String(
"invertedPolygonRenderer" ) )
82 if ( embeddedRenderer && embeddedRenderer->
type() == m->
name() )
85 currentEmbeddedIdx = idx;
89 mRendererComboBox->blockSignals(
false );
91 int oldIdx = mRendererComboBox->currentIndex();
92 mRendererComboBox->setCurrentIndex( currentEmbeddedIdx );
93 if ( oldIdx == currentEmbeddedIdx )
96 mRendererComboBox_currentIndexChanged( currentEmbeddedIdx );
104 if ( mRenderer && mEmbeddedRendererWidget )
107 if ( embeddedRenderer )
109 mRenderer->setEmbeddedRenderer( embeddedRenderer->
clone() );
112 return mRenderer.get();
118 if ( mEmbeddedRendererWidget )
119 mEmbeddedRendererWidget->setContext(
context );
125 if ( mEmbeddedRendererWidget )
126 mEmbeddedRendererWidget->setDockMode(
dockMode );
129 void QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
131 QString rendererId = mRendererComboBox->itemData( index ).toString();
135 std::unique_ptr< QgsFeatureRenderer > oldRenderer( mRenderer->embeddedRenderer()->clone() );
138 mEmbeddedRendererWidget->setContext(
mContext );
139 mEmbeddedRendererWidget->disableSymbolLevels();
140 mEmbeddedRendererWidget->setDockMode( this->
dockMode() );
143 if ( layout()->count() > 2 )
146 layout()->takeAt( 2 );
148 layout()->addWidget( mEmbeddedRendererWidget.get() );
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
static QgsFeatureRenderer * defaultRenderer(QgsWkbTypes::GeometryType geomType)
Returns a new renderer - used by default in vector layers.
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.