0

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

  • wooo amazing, this occur with Scite and geany, only one event is fired, but with VsCodium/visual code, signal is fired twice, because i guess vscodium first empty the file, 0 and then write all, by this way, signal continue to work. – Eric Petit Sep 10 '22 at 10:44

0 Answers0