No deviceConnected() signals from QBluetoothLocalDevice in QCoreApplication (but works in QApplication)
-
Hello!
I am working with a Pyside6.Qt app where we use Bluetooth, both QBluetoothLocalDevice and QBluetoothDeviceDiscoveryAgent. It works fine when I run it in a GUI app, using QApplication, but recently I've been trying to extract the Bluetooth code to maybe use in scripts. To do that I tried using QCoreApplication instead. I get the connected local devices when asking for them (connectedDevices()), I get signals for discovered BLE devices, but the signals for connected/disconnected local devices no longer work as expected.
This is on macOS (haven't tried Linux yet).Note that I am new in the Qt world, but it seems weird to me that the exact same Bluetooth code works in QApplication, but only partially in QCoreApplication.
I would be very happy for ideas on what might be wrong, but also pointers to other paths forward – like e.g. how to debug this. :-)
Best regards,
Håkan Eriksson -
Which platform is this? - for example, on Android, the BT code uses QGuiApplication.
-
For now, I have only tried this on macOS. Also, I found other things seemingly stuck when using QCoreApplication instead of QApplication, so for now I've just resigned and use QApplication (even though it feels like overkill). Will try to separate stuff into threads, I'm sure it's all just a beginner's mistake somewhere.
-
QGuiApplication is a bit smaller...