How is the enumeration for QStyle.StandardPixmap defined in PyQt6? I've tried to replicate it as shown below:
from enum import Enum
class bootlegPixmap(Enum):
SP_TitleBarMenuButton = 0
SP_TitleBarMinButton = 1
SP_TitleBarMaxButton = 2
for y in bootlegPixmap:
print(y)
I get the following output:
bootlegPixmap.SP_TitleBarMenuButton
bootlegPixmap.SP_TitleBarMinButton
bootlegPixmap.SP_TitleBarMaxButton
If I try and iterate over the original using the following code:
from PyQt6.QtWidgets import QStyle
for x in QStyle.StandardPixmap:
print(x)
I get numerical values only:
0
1
2
...
This has got nothing to do with PyQt per se. It's just the normal behaviour of Python's enum classes.
By default, the members of
IntEnum/IntFlag
print their numerical values; so if you want more informative output, you should userepr
instead:By contrast, the members of
Enum
have opaque values, so they default to a textual representation of the values:Needless to say, PyQt always uses the integer classes, since that's closest to how they're defined in Qt: