How to keep the way of using enum as sip 5 for sip 6?
Phil Thompson
phil at riverbankcomputing.com
Tue Jan 12 13:29:47 GMT 2021
On 12/01/2021 13:00, Weitian Leung wrote:
> 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)
Some directives are specific to an ABI version, others apply to all
versions.
Phil
> 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
>>
More information about the PyQt
mailing list