[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] pyqtProperty(dict) fails in PyQt 5.10 with TypeError but works in 5.8.2
From:       Peter-Simon Dieterich <dieterich.peter () gmail ! com>
Date:       2018-02-08 12:46:12
Message-ID: CAG1PBvhn-gd+1ahAnhuewBnwkp+jDwQdp8JTKOQ6SX3YWu84UQ () mail ! gmail ! com
[Download RAW message or body]

On Thu, Feb 8, 2018 at 12:48 PM, Phil Thompson
<phil@riverbankcomputing.com> wrote:
> On 7 Feb 2018, at 3:41 pm, Peter-Simon Dieterich <dieterich.peter@gmail.com> wrote:
>>
>> Hi,
>>
>> I was using a pyqtProperty of Python-type dict to pass some
>> information to Qml (QtQuick2). This worked fine in PyQt 5.8.2.
>> However, with PyQt 5.10 the application SIGABRTs with exit code 134
>> and the following error:
>>
>>    TypeError: unable to convert a Python 'dict' object to a C++
>> 'PyQt_PyObject' instance
>>
>> Am I using the pyqtProperty decorator wrongly or is this a bug?
>
> Change...
>
>>    @pyqtProperty(dict, notify=mydictChanged)
>
> ...to...
>
>     @pyqtProperty('QVariantMap', notify=mydictChanged)
>
> ...which says that the property is a dict with string keys.

This works, thank you!

> 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