[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] [SIP] TypeError: unable to convert a C++ Class::ScopedEnum instance to a Python object
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2019-10-06 20:26:15
Message-ID: aa68b62b05dfbe55936ecff3397d9908 () riverbankcomputing ! com
[Download RAW message or body]
On 06/10/2019 20:51, Denis Rouzaud wrote:
> Hi Phil,
>
> Thanks for the reply.
>
> I don't see anything particular in that file, except a difference: my
> enum
> is not declared in the same file/class that the one emitting the
> signal. Is
> there some kind of include I could add, or some method code in the
> signal?
>
> Otherwise, I could not find any ScopesStripped annotation. Is it worth
> a
> try? Do you have any example?
The .sip file I mentioned.
Phil
> Cheers,
> Denis
>
> Le sam. 5 oct. 2019 Ã 10:44, Phil Thompson
> <phil@riverbankcomputing.com> a
> écrit :
>
>> On 02/10/2019 07:48, Denis Rouzaud wrote:
>> > Hi list,
>> >
>> > I have a scoped enum in a class, a signal emitting this enum.
>> >
>> > So something like
>> >
>> > MyClass
>> > {
>> > public:
>> > enum class MyEnum
>> > {
>> > .....
>> > };
>> >
>> > signals:
>> > void mySignal( MyEnum enum );
>> > }
>> >
>> >
>> > If in Python, I do:
>> >
>> > def slot( enum ):
>> > print( enum );
>> > myClassInstance.mySignal.connect(slot)
>> >
>> > I get this error:
>> > TypeError: unable to convert a C++ MyClass::MyEnum instance to a Python
>> > object
>> >
>> >
>> > Any idea how to solve this?
>>
>> The following seems to work fine...
>>
>> from PyQt5.QtNetworkAuth import QOAuth1
>>
>> def slot(e):
>> print(e)
>>
>> auth = QOAuth1()
>> auth.statusChanged.connect(slot)
>>
>> ...so I'd suggest looking at qabstractoauth.sip (and maybe the
>> ScopesStripped annotation).
>>
>> Phil
>>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic