title: Qt QFileSystemWatcher: signal fileChanged() gets emited only once
body: <p>I was trying the <code>QFileSystemWatcher</code> out and it somehow doesn't work as expected. Or am I doing something wrong?</p>
  
  <p>I've set the <code>QFileSystemWatcher</code> to watch a single file. When I modify the file for the first time, <code>fileChanged()</code> gets emited, that's OK. But when I modify the file again, <code>fileChanged()</code> doesn't get emited anymore.</p>
  
  <p>Here is the source code:</p>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include &lt;QApplication&gt;
  
  #include "mainwindow.h"
  
  int main(int argc, char **argv)
  {
    QApplication app(argc, argv);
    MainWindow window;
  
    window.show();
  
    return app.exec();
  }
  </code></pre>
  
  <p><strong>mainwindow.h</strong></p>
  
  <pre><code>#include &lt;QDebug&gt;
  #include &lt;QFileSystemWatcher&gt;
  #include &lt;QMainWindow&gt;
  #include &lt;QString&gt;
  
  class MainWindow : public QMainWindow
  {
    Q_OBJECT
  
  public:
  
    MainWindow();
  
  private slots:
  
    void directoryChanged(const QString &amp; path);
    void fileChanged(const QString &amp; path);
  
  private:
  
    QFileSystemWatcher * watcher;
  };
  </code></pre>
  
  <p><strong>mainwindow.cpp</strong></p>
  
  <pre><code>#include "mainwindow.h"
  
  MainWindow::MainWindow()
  {
    watcher = new QFileSystemWatcher(this);
    connect(watcher, SIGNAL(fileChanged(const QString &amp;)), this, SLOT(fileChanged(const QString &amp;)));
    connect(watcher, SIGNAL(directoryChanged(const QString &amp;)), this, SLOT(directoryChanged(const QString &amp;)));
    watcher-&gt;addPath("path to directory");
    watcher-&gt;addPath("path to file");
  }
  
  void MainWindow::directoryChanged(const QString &amp; path)
  {
    qDebug() &lt;&lt; path;
  }
  
  void MainWindow::fileChanged(const QString &amp; path)
  {
    qDebug() &lt;&lt; path;
  }
  </code></pre>
  
  <p>Thank you for your answers.</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>I ran this code under Linux.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>I actually need to check all MetaPost files in a tree given by some directory, whether they were modified. I will probably stick to my alternative solution, which is to run QTimer every second and manually check all files. The QFileSystemWatcher probably does this in similar fashion internally, but probably more effectively.</p>