How to start a QEventLoop and triggers a function every 5 seconds.
Unsolved
General and Desktop
-
I have an application that would start a service when a button is clicked. I have a function that would check if the service is started more like an assertion. I have the idea on what needs to be done but not sure how I am supposed to implement it.
- I should be able to call the function that checks for the status of the service every 5 seconds only if the status is false(inactive).
- The limit should be 30 seconds. Which means the function that checks for service status is called 6 times at max.
- If the limit is reached exit the event loop. If the status is true(active) when checked after 10 seconds, then exit the loop as well.
If I could get a clear implementation detail on how to proceed with this situation it would be a great help.
Thanks and regards
-
Don't use an extra eventloop but a QTimer.
-
@Christian-Ehrlicher
I am kind of newbie to Qt so if you could be little more specific by providing an example that would highly appreciable. -
The detailed description should help here.
Create timer, connect timeout to the your custom slot, do your work and checks in there.