C++ Qt Console App â How to read user input in event driven program state?
Today I began making a console app in C++ w/ Qt. At first I am just making the app monitor a file and detect when the file is modified. I created a slot to catch when that signal triggers. At first I had a while () loop in the main { } section to catch user input (had a command so it would display what files are configured to watch) but once I got the signal and slot connection working I noticed that the entire console app is actually in an event driven flow state, not a sequential flow state like normal C++ console app. So when it was in the while loop to monitor user input, the messages from the slot when the file would be modified wouldn't occur until after the while loop ended, which was at program exit. I commented out the while loop, and indeed, the app is running in an event driven state, ie: the main {} block executes and can have no loop in it but the app remains running. It sits listening for events to react to. How can I make Qt accept user input in the event driven state?