-1

I have created a simple, single thread, app in Qt6. My sole class creates a couple of timers and prints a qDebug message in the timeout slot. These messages never print.

My class is created before the app.exec() in main, so before the event loop is executed. I suspect this is related. If I create QTimers and connect the timeout signal, before the event loop exec is called, are my signals-slots lost once exec is called? What's the right way to handle this?

Note: This question is about use of QTimer & Eventloop. Not looking for help with specific code. (i.e. theory)

TSG
  • 4,242
  • 9
  • 61
  • 121
  • 1
    Sorry, but do you really expect anyone will be able to help you without seeing any code. Please provide a [mcve]. – G.M. Jul 01 '23 at 14:00
  • The question is meant to be theoretical - can I post events before starting the event loop, or are they lost? I've used enough QTimers that I don't need code help. – TSG Jul 01 '23 at 15:03

1 Answers1

0

After testing I can confirm that events posted before the event loop starts (.exec) are queued. Similarly, connects created before the event loop starts are also retained - so once the vent loop starts those slots receive the attached signals.

TSG
  • 4,242
  • 9
  • 61
  • 121