How to keep the way of using enum as sip 5 for sip 6?

Weitian Leung weitianleung at gmail.com
Tue Jan 12 13:00:56 GMT 2021


Many thanks, it works.
Does it affect the directives requires abi 13 too? As my test the
%ReleaseCode works with abi 12 also. (I love the %RealeaseCode directive
LoL)

On Tuesday, January 12, 2021, Phil Thompson <phil at riverbankcomputing.com>
wrote:
> On 12/01/2021 05:19, Weitian Leung wrote:
>>>
>>> - All enums are now implemented as enum.Enum (PyQt5 used enum.IntEnum
for
>>> scoped enums and a custom type for traditional named enums). PyQt5
allowed
>>> an int whenever an enum was expected but PyQt6 requires the correct
type.
>>> - QFlags are implemented as enum.Flag.
>>
>>
>> As mentioned in PyQt6 released news, I found this also affected non-PyQt
>> project with sip 6, such as:
>>
>>> namespace demo {
>>>     enum Hello {
>>>         World = 0
>>>     }
>>> }
>>>
>>
>> Will not possibly be used as *demo.World* with python. Searching the
>> document found the /NoScope/ but didn't help, it just failed to compile.
>> The only way for now I can see is removing the enum name (Hello for
>> example), but it's just too weird.
>>
>> Is there another way to make enum compatible with sip 5?
>
> SIP implements a number of ABI versions. The new enum behaviour is
implemented in v13, which is the latest version and therefore the default
version.
>
> If you want the old behaviour then specify ABI v12 (as PyQt5 does).
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210112/2286f83d/attachment.htm>


More information about the PyQt mailing list