Console output in a Qt GUI app?
I have a Qt GUI application that allows command-line options to be passed and under some circumstances I want to output a message to the console and then quit, for example:

    int main(int argc, char *argv[])
    {
      QApplication a(argc, argv);
    
      if (someCommandLineParam)
      {
        std::cout << "Hello, world!";
        return 0;
      }
    
      MainWindow w;
      w.show();
    
      return a.exec();
    }

However, the console messages do not appear.  Does anyone know how I can get this to work?

Console output in a Qt GUI app?
===

I have a Qt GUI application that allows command-line options to be passed and under some circumstances I want to output a message to the console and then quit, for example:

    int main(int argc, char *argv[])
    {
      QApplication a(argc, argv);
    
      if (someCommandLineParam)
      {
        std::cout << "Hello, world!";
        return 0;
      }
    
      MainWindow w;
      w.show();
    
      return a.exec();
    }

However, the console messages do not appear.  Does anyone know how I can get this to work?
