QFileSystemWatcher fired only one time

Viewed 11

I'm writing QtVsPlayer https://github.com/surfzoid/QtVsPlayer I add a QFileSystemWatcher in this way :

.h

private:
QFileSystemWatcher *watcher;

private slots:
    void showModified(const QString& str);

.cpp

QtVsPlayer::QtVsPlayer(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::QtVsPlayer)
{
    watcher = new QFileSystemWatcher;
    watcher->addPath(QStandardPaths::writableLocation(
                         QStandardPaths::GenericCacheLocation)
                     + "/QtVsPlayer");

connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(showModified(QString)));
}

void QtVsPlayer::showModified(const QString& str)
{
    qDebug() << "New file is stored in  : " << str <<"\n";
}

I start my app and write some texte ~/.cache/QtVsPlayer file and save it, signal is fired, but if again i do this, signal isn't fired anymore.

Is there an option to limited or unlimited fileChanged event?

Thank you for any help

0 Answers
Related