[PyQt] QThread, Slots, Signals, meta type information error
Giuseppe Corbelli
corbelligiuseppe at mesdan.it
Mon Mar 4 08:20:17 GMT 2019
On 3/1/19 5:39 PM, Repscher, Benedikt wrote:
> I'm having an Issue regarding QThreads, Slots and Signals and meta type information.
>
> The Issue arises when I try to connect a signal, e.g.
> QBluetoothDeviceDiscoveryAgent.deviceDiscovered
> to a slot, e.g.
> deviceDiscovered(device)
> where the device is of type QBluetoothDeviceInfo
>
> The signal-slot connection is done from within a QThread.
>
> The error that arises is
> QObject::connect: Cannot queue arguments of type 'QBluetoothDeviceInfo'
> (Make sure 'QBluetoothDeviceInfo' is registered using qRegisterMetaType().)
Well, I don't know the internals but the call should be generated by
SIP. The QBluetoothDeviceInfo class definition in SIP looks fine at a
first glance.
> I've tried generating the meta type info explicitly using
> char_id = QMetaType.type("QBluetoothDeviceInfo")
> this doesn't help though (and returns 0 anyways)
>
>
> What really baffles me is, that this error only occurs when I
> implement the QThread the traditional way by subclassing QThread and
> overriding run().
> When I use the approach with the controller that moves the QObject
> to a QThread (using moveToThread()), then the code works.
I don't see anything wrong with your code, BUT:
https://blog.qt.io/blog/2010/06/17/youre-doing-it-wrong/
--
Giuseppe Corbelli
More information about the PyQt
mailing list