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() ),
47 this->setLayout( layout );
48 layout->addWidget( label );
52 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 const 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 );
129void QgsMergedFeatureRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
131 const QString rendererId = mRendererComboBox->itemData( index ).toString();
135 const 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() );
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...