Creating a timed menu in Main()
Using Qt5 and QCoreApplication I want to create a timed menu that waits 15 seconds for a response, and if one is not received, moves on to the eventloop and the rest of the program. This program is ran completely from the console. I have tried using a timed while loop, however
stops the loop and waits for a response.
Any ideas on how to go about creating this?
Re: Creating a timed menu in Main()
Quote:
Originally Posted by
simy307
Using Qt5 and QCoreApplication I want to create a timed menu that waits 15 seconds for a response, and if one is not received, moves on to the eventloop and the rest of the program. This program is ran completely from the console. I have tried using a timed while loop, however
stops the loop and waits for a response.
Any ideas on how to go about creating this?
!!! get a timer, with a flag set. if user inputs something readline returns with flag set to entered.
else, if timer passed with no input, then write dummy chars to get rid of readline.
Re: Creating a timed menu in Main()
Quote:
Originally Posted by
simy307
Using Qt5 and QCoreApplication I want to create a timed menu that waits 15 seconds for a response, and if one is not received, moves on to the eventloop and the rest of the program. This program is ran completely from the console. I have tried using a timed while loop, however
stops the loop and waits for a response.
Any ideas on how to go about creating this?
Setup a QSocketNotifier on stdin, connect to its signal and run the event loop (e.g. via QEventLoop). Together with a timer that will quit the loop after 15 seconds, you can set a mechanism appropriate for your task.