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

Jason H jhihn at gmx.com
Thu Apr 11 03:35:34 CEST 2019


Because I can't. The QML engine is loading, creating the objects. There is nothing I can return to.

Its like I want to create the event loop, init, then hand the app.exec() pick up the events already queued in the event loop...



> Sent: Thursday, April 11, 2019 at 3:20 AM
> From: "Tony Rietwyk" <tony at rightsoft.com.au>
> To: interest at qt-project.org
> Subject: Re: [Interest] Signals, slots before the event loop starts?
>
> Hi Jason,
>
> Why can't your initialisation pass back a status to the main routine?
>
> Otherwise I suggest to use a short timer, so it gets picked up early
> when the main event loop starts.
>
> Hope that helps, Tony
>
>
> On 11/04/2019 8:18 am, Jason H wrote:
> > 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?
> >
> >
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > https://lists.qt-project.org/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>



More information about the Interest mailing list