[Interest] Signals, slots before the event loop starts?

Jason H jhihn at gmx.com
Thu Apr 11 00:18:55 CEST 2019


I've now come across two places in my code where this is an issue (at various states of initializing)

In a QObject who is exported to QML, and is instantiated just below the top-level Window:
//  in the object's open() method:
if (!_serialPort.open(QIODevice::ReadWrite))
	qApp->quit(); // won't actually quit - no use if I can't use the serial port. (because another instance is using it)

Then I have a ready() signal that is emitted when the serial device is ready, however the QML, when I hook onReady, it never gets called. I have to use a Component.onCompleted at the top level. However, there is async serial I/O happening, so there is at least one event loop?

What can I do to make sure these things work?







More information about the Interest mailing list