[PyQt] QThread, Slots, Signals, meta type information error

Repscher, Benedikt Benedikt.Repscher at webasto.com
Tue Mar 5 12:56:27 GMT 2019

> I don't have a pyqt+btle installation but, strictly Qt speaking:
> "A single QMetaObject instance is created for each QObject subclass that is used in an application [...]"
I too read that somewhere
> And QBluetoothDeviceInfo is not a QObject subclass.
This though, I hadn't noticed yet.

> AFAIK (little and less, admittedly) however your issue is related to the serialization that must be done to copy the object so that the target thread can have its own instance. In turn this means that QMetaType info should be available for the class, and in fact it is by looking at the
> Q_DECLARE_METATYPE(QBluetoothDeviceInfo) line in qbluetoothdeviceinfo.h
OK, but I'm guessing declaring and registering are two different things, otherwise this error:
QObject::connect: Cannot queue arguments of type 'QBluetoothDeviceInfo'
(Make sure 'QBluetoothDeviceInfo' is registered using qRegisterMetaType().)
Wouldn’t be raised.

> So basically I cannot be of much help, since everything seems to be in the right place.
> Did you try the connection without the pyqtSlot decorator?
Yes, it doesn't change a thing.

> Out of curiosity: why are you explicitly calling the underlying
> thread().exec_() in a QObject moved to that thread?
So the signals that are received by the slots are processed.
I'm guessing this question is a hint towards my suboptimal usage of the moveToThread()-approach.
I wanted to have as minimal differences between both of the implementations as possible...

More information about the PyQt mailing list