41 QGridLayout *layout =
new QGridLayout(
this );
42 QLabel *label =
new QLabel( tr(
"The inverted polygon renderer only applies to polygon and multipolygon layers. \n"
43 "'%1' is not a 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, &QgsInvertedPolygonRendererWidget::mRendererComboBox_currentIndexChanged );
51 connect( mMergePolygonsCheckBox, &QCheckBox::stateChanged,
this, &QgsInvertedPolygonRendererWidget::mMergePolygonsCheckBox_stateChanged );
66 mMergePolygonsCheckBox->blockSignals(
true );
67 mMergePolygonsCheckBox->setCheckState(
mRenderer->preprocessingEnabled() ? Qt::Checked : Qt::Unchecked );
68 mMergePolygonsCheckBox->blockSignals(
false );
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(
"invertedPolygonRenderer" ) )
83 if ( embeddedRenderer && embeddedRenderer->
type() == m->
name() )
86 currentEmbeddedIdx = idx;
90 mRendererComboBox->blockSignals(
false );
92 const int oldIdx = mRendererComboBox->currentIndex();
93 mRendererComboBox->setCurrentIndex( currentEmbeddedIdx );
94 if ( oldIdx == currentEmbeddedIdx )
97 mRendererComboBox_currentIndexChanged( currentEmbeddedIdx );
108 if ( embeddedRenderer )
130void QgsInvertedPolygonRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
132 const QString rendererId = mRendererComboBox->itemData( index ).toString();
136 const std::unique_ptr< QgsFeatureRenderer > oldRenderer(
mRenderer->embeddedRenderer()->clone() );
144 if ( layout()->count() > 2 )
147 layout()->takeAt( 2 );
153void QgsInvertedPolygonRendererWidget::mMergePolygonsCheckBox_stateChanged(
int state )
155 mRenderer->setPreprocessingEnabled( state == Qt::Checked );
WkbType
The WKB type describes the number of dimensions a geometry has.
@ CurvePolygon
CurvePolygon.
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
Abstract base class for all 2D vector feature renderers.
virtual void setEmbeddedRenderer(QgsFeatureRenderer *subRenderer)
Sets an embedded renderer (subrenderer) for this feature renderer.
void copyRendererData(QgsFeatureRenderer *destRenderer) const
Clones generic renderer data to another renderer.
virtual const QgsFeatureRenderer * embeddedRenderer() const
Returns the current embedded renderer (subrenderer) for this feature renderer.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
QgsInvertedPolygonRenderer is a polygon-only feature renderer used to display features inverted,...
static QgsInvertedPolygonRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
Creates a QgsInvertedPolygonRenderer 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::WkbType singleType(Qgis::WkbType type)
Returns the single type for a WKB type.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.