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

Giuseppe Corbelli corbelligiuseppe at mesdan.it
Tue Mar 5 14:53:35 GMT 2019

On 3/5/19 1:56 PM, Repscher, Benedikt wrote:
>> 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.

Well, seems to me this is a QT bug. To use queued connections you also 
need the qRegisterMetaType<QBluetoothDeviceInfo>() call.
Looking at qtconnectivity sources 1b19d7 the call is not made in bluez 
implementation while it is on other platforms (android, osx, ios, 
winrt). That seems the root cause.
If you have your Qt environment I would try to add the missing call to 
bluez platform and if it solves the issue file a bug against current Qt.

Giuseppe Corbelli

More information about the PyQt mailing list