16#include "moc_qgsinvertedpolygonrendererwidget.cpp"
42 QGridLayout *layout =
new QGridLayout(
this );
43 QLabel *label =
new QLabel( tr(
"The inverted polygon renderer only applies to polygon and multipolygon layers. \n"
44 "'%1' is not a 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, &QgsInvertedPolygonRendererWidget::mRendererComboBox_currentIndexChanged );
52 connect( mMergePolygonsCheckBox, &QCheckBox::stateChanged,
this, &QgsInvertedPolygonRendererWidget::mMergePolygonsCheckBox_stateChanged );
67 mMergePolygonsCheckBox->blockSignals(
true );
68 mMergePolygonsCheckBox->setCheckState(
mRenderer->preprocessingEnabled() ? Qt::Checked : Qt::Unchecked );
69 mMergePolygonsCheckBox->blockSignals(
false );
71 int currentEmbeddedIdx = 0;
74 QStringList::const_iterator it = rendererList.constBegin();
76 mRendererComboBox->blockSignals(
true );
77 for ( ; it != rendererList.constEnd(); ++it, ++idx )
79 if ( *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 );
109 if ( embeddedRenderer )
131void QgsInvertedPolygonRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
133 const QString rendererId = mRendererComboBox->itemData( index ).toString();
137 const std::unique_ptr< QgsFeatureRenderer > oldRenderer(
mRenderer->embeddedRenderer()->clone() );
145 if ( layout()->count() > 2 )
148 layout()->takeAt( 2 );
154void QgsInvertedPolygonRendererWidget::mMergePolygonsCheckBox_stateChanged(
int state )
156 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.