[QGIS-Developer] QgsMapLayerCombobox with multiple filters

pierluigi de rosa pierluigi.derosa at gmail.com
Mon Jul 12 22:38:28 PDT 2021


Thanks a lot for your answer.

I solved my problem
P

Il giorno lun 12 lug 2021 alle ore 19:56 Benjamin Jakimow <
benjamin.jakimow at geo.hu-berlin.de> ha scritto:

> 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
> <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
>
> _______________________________________________
> 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
>


-- 
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/20210713/23d0d97a/attachment.html>


More information about the QGIS-Developer mailing list