<div dir="ltr"><div>Thanks. And that function works well for e.g. 
qgis.qgis.PyQt.Qt.QCborSimpleType. Which by the way has type 
enum.EnumType, and is defined in QGIS/share/qgis/python/qgis/PyQt/Qt.py.</div><div><br></div><div>But
 Im talking about an "enum" created by SIP. Such an "enum" is a class 
definition, with 'int' as its only parent class. It has around 14 
enum-members, e.g. "Symbology". But there is no way of getting a 
complete list of them. Neither with __dict__ nor dir. </div><div><br></div><div>>>> from qgis.core import QgsMapLayer<br>>>> QgsMapLayer.StyleCategory<br><class 'qgis._core.QgsMapLayer.StyleCategory'><br>>>> type(QgsMapLayer.StyleCategory)<br><class 'sip.enumtype'><br>>>> QgsMapLayer.StyleCategory.__dict__<br>mappingproxy({'__module__':
 'qgis._core', '__or__': <slot wrapper '__or__' of 'StyleCategory' 
objects>, '__ror__': <slot wrapper '__ror__' of 'StyleCategory' 
objects>, '__dict__': <attribute '__dict__' of 'StyleCategory' 
objects>, '__doc__': None, '__reduce__': <method '_pickle_enum' of
 'StyleCategory' objects>, 'baseClass': <class 
'qgis._core.QgsMapLayer'>})<br>>>> dir(QgsMapLayer.StyleCategory)<br>['__abs__',
 '__add__', '__and__', '__bool__', '__ceil__', '__class__', 
'__delattr__', '__dict__', '__dir__', '__divmod__', '__doc__', '__eq__',
 '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', 
'__getattribute__', '__getnewargs__', '__getstate__', '__gt__', 
'__hash__', '__index__', '__init__', '__init_subclass__', '__int__', 
'__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__module__',
 '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', 
'__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', 
'__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__',
 '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', 
'__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', 
'__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', 
'__trunc__', '__xor__', 'as_integer_ratio', 'baseClass', 'bit_count', 
'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 
'is_integer', 'numerator', 'real', 'to_bytes']<br>>>> QgsMapLayer.StyleCategory.Symbology # but the members are there !<br>2</div><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Jul 2, 2025 at 10:00 AM Julien Cabieces <<a href="mailto:julien.cabieces@oslandia.com">julien.cabieces@oslandia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi,<br>
<br>
If you want an example, it has been done here: <br>
<a href="https://github.com/qgis/QGIS/blob/cb48529abf5bd81e3c97d09809e3d56e51c943bd/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py#L796" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/blob/cb48529abf5bd81e3c97d09809e3d56e51c943bd/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py#L796</a><br>
<br>
You have to use __dict__. But I'm not sure this is a good thing to use<br>
this in a plugin. The script I mention is an helper for migration from<br>
qt5 to qt6, so it's kind of special.<br>
<br>
Regards,<br>
Julien<br>
<br>
<br>
<br>
> Happy summer to all of you :)<br>
><br>
> 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<br>
> introspection.<br>
><br>
> But how can I get a list with all enum-members (e.g. Symbology, Fields) of that enum?<br>
><br>
> dir(QgsMapLayer.StyleCategory) does not list them, and QgsMapLayer.StyleCategory.__members__ is undefined. <br>
><br>
> Do I really have to hard code the member names into my plugin, if I want to iterate over all of them?<br>
><br>
> Sincerely, Thomas<br>
><br>
> _______________________________________________<br>
> QGIS-Developer mailing list<br>
> <a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br>
-- <br>
<br>
Julien Cabieces<br>
Senior Developer at Oslandia<br>
<a href="mailto:julien.cabieces@oslandia.com" target="_blank">julien.cabieces@oslandia.com</a><br>
</blockquote></div>