After having defined what happens upon usecase success, we need to handle user input.
We want the user to type in an action name (check available groceries). If the name is correct, we trigger the usecase and exit; otherwise, we print an Action not supported message and exit.
We first display the action prompt to the user:
(cout << "Enter action: ").flush();
We then create another QTextStream and bind it to stdin:
Further, we wait for user input and save it to a QString called action:
The readLine is triggered as soon as the user presses the Return key.
Finally, check the string, ...