Hello,
I've simple console application and cannot find solution how to wait for some key before exit from it. It's simple with getchar() or std::cin.ignore, but I want to do it with Qt, because for console communication I already use it:
Qt Code:
  1. int main() {
  2. QTextStream cout(stdout);
  3. QTextStream cin(stdin);
  4. // ...
  5. cout << "Press <ENTER> to exit." << endl;
  6. forever {
  7. QString Line = cin.readLine();
  8. if (!Line.isNull()) {
  9. break;
  10. }
  11. }
  12. return 0;
  13. }
To copy to clipboard, switch view to plain text mode 
Code inside forever was taken from stackoverflow, but doesn't work for me. Qt 4.7.3
Do you know some other solutions?