[QGIS-Developer] QgsMapLayerCombobox with multiple filters

pierluigi de rosa pierluigi.derosa at gmail.com
Mon Jul 12 10:51:37 PDT 2021


Dear All,

I'm experiencing some problems with the QgsMapLayerComboBox.
I would like to filter all line and polygon layer.
Here below my code:

self.overlayLayer_ComboBox.setFilters(QgsMapLayerProxyModel.PointLayer,QgsMapLayerProxyModel.LineLayer)

But I have and Error. I can add only one layer type. Even the
QgsmapLayerProxyModel.VectorLayer
<https://qgis.github.io/pyqgis/3.2/core/Map/QgsMapLayerProxyModel.html?highlight=qgsmaplayerproxymodel%20pointlayer#qgis.core.QgsMapLayerProxyModel.VectorLayer>
is
not suitable.
I want to show only line and polygon.
Can anyone help me?
Thank you
Pierluigi
-- 
Ing. Pierluigi De Rosa (PhD in Earth Science)
Contract Professor of Geographic Information System at University of Perugia
cel: 3497558268 / fax: 075 7823038
skype: pierluigi.derosa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210712/56005c3a/attachment.html>


More information about the QGIS-Developer mailing list