title: QT detect directory and subfolders changes
body: <p>i want to detect any changes in a directory uncluding subfolders :  </p>
  
  <p>exemple : if i put a listner in the directory D:\dropbox  i want my application shows this :</p>
  
  <ul>
  <li>D:\dropbox\folder1\file1.txt   is deleted</li>
  <li>D:\dropbox\folder1\folder2   is created</li>
  <li>D:\dropbox\public    is modified</li>
  <li>...</li>
  </ul>
  
  <p>i have found this exemple in the internet but it show only a simple message : "the directory is changed "</p>
  
  <p>please can any body help me ?</p>
  
  <pre><code>#ifndef MYCLASS_H
  #define MYCLASS_H
  
  #include &lt;QWidget&gt;
  #include &lt;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)
          QMessageBox::information(this,"Directory Modified", "Your Directory is modified");
      }
  };
  
  #endif // MYCLASS_H
  
  
  
  #include &lt;QApplication&gt;
  #include &lt;QFileSystemWatcher&gt;
  #include &lt;QDebug&gt;
  
  #include "MyClass.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>