[PyQt] pyqtProperty(dict) fails in PyQt 5.10 with TypeError but works in 5.8.2

Peter-Simon Dieterich dieterich.peter at gmail.com
Thu Feb 8 12:46:12 GMT 2018


On Thu, Feb 8, 2018 at 12:48 PM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On 7 Feb 2018, at 3:41 pm, Peter-Simon Dieterich <dieterich.peter at 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


More information about the PyQt mailing list