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

Phil Thompson phil at riverbankcomputing.com
Thu Feb 8 11:48:37 GMT 2018


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.

Phil


More information about the PyQt mailing list