Qt 4.7 QFileSystemWatcher example

249 views Asked by At

i want to observe a path with the QFileSystemWatcher in QT 4.7. In QT 5.x work my program, but I don't know why it don't work in QT 4.7.

QT 5.x

QFileSystemWatcher watcher;
watcher.addPath("myPath");

QStringList directoryList = watcher.directories();
Object::connect(&watcher, &QFileSystemWatcher::directoryChanged, [](const QString path){
    QDirIterator it(path, {"*"}, Dir::Files);
    while(it.hasNext()){
       // do something
    }
});

QT 4.7

QFileSystemWatcher watcher;
watcher.addPath("myPath");

QString path;
Object::connect(&watcher, &QFileSystemWatcher::directoryChanged, &path, ?{
    // do something
});

Can give me anyone a run able example for qt4.7? Thanks for any help.

0

There are 0 answers