title: Qt console application "WARNING: QApplication was not created in the main() thread"
body: <p>I'm creating a very simple C++ QT console application from an example given here on stack overflow.</p>
  
  <p><a href="https://stackoverflow.com/questions/10044853/how-to-qfilesystemwatcher">How to use QFileSystemWatcher to monitor a folder for change</a></p>
  
  <p>The code is exactly as the code in that application and I'm developing with Qt's UI, Qt Creator with MinGW 32bit. I selected the console application from the projects I could choose as I have no need for a graphical user interface. Once the application has finished loading, the application shows the error message "WARNING: QApplication was not created in the main() thread" then does nothing.</p>
  
  <p>I have tried debugging the application but get no breakpoints hit, I don't think debugging is working in the editor.</p>
  
  <p>I had a quick go and changed the QApplication to a QCoreApplication seen as I am developing a console application but get the exact same error message.</p>
  
  <p>filesystemreceiver.h</p>
  
  <pre><code>#ifndef FILESYSTEMRECEIVER_H
  #define FILESYSTEMRECEIVER_H
  
  #include &lt;iostream&gt;
  
  using namespace std;
  
  #include &lt;QtCore/QApplication&gt;
  #include &lt;QtCore/QFileSystemWatcher&gt;
  #include &lt;QtCore/QDebug&gt;
  #include &lt;QtWidgets/QWidget&gt;
  #include &lt;QtWidgets/QMessageBox&gt;
  
  class MyClass : public QWidget
  {
      Q_OBJECT
  public:
      MyClass(QWidget* parent=0)
          :QWidget(parent){}
  
      ~MyClass() {}
  public slots:
      void showModified(const QString&amp; str)
      {
          Q_UNUSED(str)
          cout &lt;&lt; "A message has been received!" &lt;&lt; endl;
          //QMessageBox::information(this,"Directory Modified", "Your Directory is modified");
      }
  };
  
  #endif // FILESYSTEMRECEIVER_H
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  #include &lt;QtCore/QApplication&gt;
  #include &lt;QtCore/QFileSystemWatcher&gt;
  #include &lt;QtCore/QDebug&gt;
  #include &lt;QtWidgets/QWidget&gt;
  #include &lt;QtWidgets/QMessageBox&gt;
  
  #include "fileSystemReceiver.h"
  
  int main(int argc, char* argv[])
  {
      QApplication app(argc, argv);
      QFileSystemWatcher watcher;
      watcher.addPath("C:/QtTest");
  
      QStringList directoryList = watcher.directories();
      Q_FOREACH(QString directory, directoryList)
                qDebug() &lt;&lt; "Directory name" &lt;&lt; directory &lt;&lt;"\n";
  
      MyClass* mc = new MyClass;
  
      QObject::connect(&amp;watcher, SIGNAL(directoryChanged(QString)), mc, SLOT(showModified(QString)));
  
      return app.exec();
  }
  </code></pre>
  
  <p>My pro file looks like this:</p>
  
  <pre><code>QT       += core
  QT       += widgets
  
  QT       -= gui
  
  TARGET   =  fsw
  CONFIG   += console
  CONFIG   -= app_bundle
  
  TEMPLATE = app
  
  HEADERS += fileSystemReceiver.h
  
  SOURCES  += \
      main.cpp
  </code></pre>