[PyQt] Unable to call methods returning void from Qml Plugins

Phil Thompson phil at riverbankcomputing.com
Sat Sep 13 16:18:35 BST 2014

On 13/09/2014 2:51 pm, pwuertz wrote:
> Hi,
> I developed a QML plugin with Qt Creator which I'd like to use in a 
> PyQt5
> application. It is loaded in a qml scene and I can access my custom
> QQuickItems from python just fine (properties, signals..). However, 
> calling
> a Slot that returns a void results in the following TypeError:
> Trying to create a QVariant instance of QMetaType::Void type, an 
> invalid
> QVariant will be constructed instead

Sounds like a hack.

> Traceback (most recent call last)
>  -- cut --
> TypeError: unable to convert a QVariant of type 0 to a QMetaType of 
> type 43

I can handle that as a specific special case.

> When I rewrite the method of my custom QQuickItem so it returns a bool
> instead of void, calling the slot from python works perfectly fine. 
> Also
> calling the void method from Qml works as expected.
> The PyQt version on my system is 5.3.1.

Try tonight's snapshot.


More information about the PyQt mailing list