[QGIS-Developer] For an enum in pyqgis, how do I list all members and do reverse lookups?
Thomas Larsen Wessel
mrvelle at gmail.com
Wed Jul 2 00:39:35 PDT 2025
Happy summer to all of you :)
It seems in the Python bindings produced by SIP, a C++ enum is just a
Python class with a certain structure. And with little/none possibility of
introspection.
But how can I get a list with all enum-members (e.g. Symbology, Fields) of
that enum?
dir(QgsMapLayer.StyleCategory) does not list them, and
QgsMapLayer.StyleCategory.__members__ is undefined.
Do I really have to hard code the member names into my plugin, if I want to
iterate over all of them?
Sincerely, Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20250702/fed308ef/attachment.htm>
More information about the QGIS-Developer
mailing list