Unsupported return type QList<qint64>
Phil Thompson
phil at riverbankcomputing.com
Fri Jun 21 13:22:48 BST 2024
On 20/06/2024 09:38, Julien Cabieces wrote:
> Sorry Phil I answered directly to you instead of the list, here is the
> same message and more.
>
> QList is a template mapped type so it should work with other
> primitive type, no?
No. Mapped type templates only work as templates when type arguments are
wrapped types. With other type arguments (eg. primitive types) they work
as template selectors. This is because the Python API is different for
converting different primitive types.
> It does work with QList<long long> although there
> is no mapped type
> provided, and qint64 is nothing more than a long long.
SIP will select a template based on the underlying primitive types (ie.
after resolving any typedefs) according to the current platform and
version of Qt. PyQt implements a mapped type for QList<qsizetype> when
building against Qt v6.5.0 or later. PyQt defines both qint64 and
qsizetype as long long so it will pick that mapped type for Qt v6.5.0 or
later and fail with earlier versions.
> Contrary to what I said before, it doesn't look like it's
> related to different minor version of sip 6.
>
> According to my test:
>
> - QList<qint64> works with sip 6 on fedora (39, 40) but fails on debian
> (stable, testing, unstable).
>
> - QList<qint64> has never worked with sip 4 (fedora or debian).
You mention PyQt6-Qt6 but this is irrelevant as you aren't building
against that Qt installation. I assume you are building against the
distro's Qt installation. Do Fedora and Debian have different versions
of Qt?
> Any idea on how to fix this except for a "if debian" directives?
The correct fix is to provide your own QList<qint64> mapped type (maybe
only with version of Qt older than v6.5).
> Regards,
> Julien
>
>> On 18/06/2024 14:09, Julien Cabieces wrote:
>>> Hi,
>>> When I try to bind a method with a return type QList<qint64>, I get
>>> the following error
>>> sip-build: testmod.sip: line 27: column 3: 'Test::testList' has an
>>> unsupported return type - provide %MethodCode and a C++ signature
>>> I get this error only with the following installed software:
>>> PyQt-builder==1.16.2 PyQt6==6.7.0 PyQt6-Qt6==6.7.0 PyQt6-sip==13.6.0
>>> sip==6.8.3
>>> and not with
>>> PyQt-builder==1.15.2 PyQt6==6.6.0 PyQt6-Qt6==6.6.0 PyQt6-sip==13.6.0
>>> sip==6.7.12
>>> How can I fix it to match both software versions
>>> Regards,
>>> Julien
>>
>> PyQt doesn't provide a mapped type for QList<qint64> so I don't
>> understand how it worked with the older versions.
>>
>> Phil
More information about the PyQt
mailing list