45 QGridLayout *layout =
new QGridLayout(
this );
46 QLabel *label =
new QLabel( tr(
"The inverted polygon renderer only applies to polygon and multipolygon layers. \n"
47 "'%1' is not a 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, &QgsInvertedPolygonRendererWidget::mRendererComboBox_currentIndexChanged );
55 connect( mMergePolygonsCheckBox, &QCheckBox::stateChanged,
this, &QgsInvertedPolygonRendererWidget::mMergePolygonsCheckBox_stateChanged );
70 mMergePolygonsCheckBox->blockSignals(
true );
71 mMergePolygonsCheckBox->setCheckState(
mRenderer->preprocessingEnabled() ? Qt::Checked : Qt::Unchecked );
72 mMergePolygonsCheckBox->blockSignals(
false );
74 int currentEmbeddedIdx = 0;
77 QStringList::const_iterator it = rendererList.constBegin();
79 mRendererComboBox->blockSignals(
true );
80 for ( ; it != rendererList.constEnd(); ++it, ++idx )
82 if ( *it != QLatin1String(
"invertedPolygonRenderer" ) )
87 if ( embeddedRenderer && embeddedRenderer->
type() == m->
name() )
90 currentEmbeddedIdx = idx;
94 mRendererComboBox->blockSignals(
false );
96 const int oldIdx = mRendererComboBox->currentIndex();
97 mRendererComboBox->setCurrentIndex( currentEmbeddedIdx );
98 if ( oldIdx == currentEmbeddedIdx )
101 mRendererComboBox_currentIndexChanged( currentEmbeddedIdx );
112 if ( embeddedRenderer )
134 void QgsInvertedPolygonRendererWidget::mRendererComboBox_currentIndexChanged(
int index )
136 const QString rendererId = mRendererComboBox->itemData( index ).toString();
140 const std::unique_ptr< QgsFeatureRenderer > oldRenderer(
mRenderer->embeddedRenderer()->clone() );
148 if ( layout()->count() > 2 )
151 layout()->takeAt( 2 );
157 void QgsInvertedPolygonRendererWidget::mMergePolygonsCheckBox_stateChanged(
int state )
159 mRenderer->setPreprocessingEnabled( state == Qt::Checked );
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.
void copyRendererData(QgsFeatureRenderer *destRenderer) const
Clones generic renderer data to another 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 QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
Type
The WKB type describes the number of dimensions a geometry has.
static Type singleType(Type type) SIP_HOLDGIL
Returns the single type for a WKB type.
static Type flatType(Type type) SIP_HOLDGIL
Returns the flat type for a WKB type.