[QGIS-Developer] QgsMapLayerCombobox with multiple filters

Benjamin Jakimow benjamin.jakimow at geo.hu-berlin.de
Mon Jul 12 10:56:44 PDT 2021


Hi Pierluigi,

you need to combine the Flags as binary Or ('|') :

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

/Benjamin

On 2021-07-12 19:51, pierluigi de rosa wrote:

> 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 [1] 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
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
--
Benjamin Jakimow, Doctoral Researcher
Earth Observation Lab | Geography Department | Humboldt-Universität zu 
Berlin

e-mail: benjamin.jakimow at geo.hu-berlin.de

phone:  +49 (0) 30 2093 6894
mobile: +49 (0) 157 5656 8477
fax:    +49 (0) 30 2093 6848
mail:   Unter den Linden 6 | 10099 Berlin | Germany
room: 2'222

Links:
------
[1] 
https://qgis.github.io/pyqgis/3.2/core/Map/QgsMapLayerProxyModel.html?highlight=qgsmaplayerproxymodel%20pointlayer#qgis.core.QgsMapLayerProxyModel.VectorLayer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210712/be1a85f4/attachment-0001.html>


More information about the QGIS-Developer mailing list