someClass::someClass(){ // <- constructor
connect( fw,
SIGNAL(fileChanged
(QString)),
this,
SLOT( fileChangedSlot
(QString)) );
// <- never emit // connect( fw, SIGNAL(directoryChanged(QString)), this, SLOT( fileChangedSlot(QString)) ); //emit but files() is empty, directories() is ok, I can see d:/test
fw->addPath( "D:/test" );
qDebug() << fw->files() << fw->directories(); // outputs: () ("D:/test") in test ther are file
}
void someClass
::fileChangedSlot(QString fileName
) {
#ifdef QT_DEBUG
qDebug() << "files watched: " << fw->files() << fw->directories();
#endif
}
someClass::someClass(){ // <- constructor
fw = new QFileSystemWatcher( this );
connect( fw, SIGNAL(fileChanged(QString)), this, SLOT( fileChangedSlot(QString)) ); // <- never emit
// connect( fw, SIGNAL(directoryChanged(QString)), this, SLOT( fileChangedSlot(QString)) ); //emit but files() is empty, directories() is ok, I can see d:/test
fw->addPath( "D:/test" );
qDebug() << fw->files() << fw->directories(); // outputs: () ("D:/test") in test ther are file
}
void someClass::fileChangedSlot(QString fileName)
{
#ifdef QT_DEBUG
qDebug() << "files watched: " << fw->files() << fw->directories();
#endif
}
To copy to clipboard, switch view to plain text mode
if I delete test directory, then:
QFileSystemWatcher: FindNextChangeNotification failed!! (Access is denied.)
To copy to clipboard, switch view to plain text mode
So QFileSystemWatcher don't add files in that directory to "watch list" (there is 6files)
I have no idea why is that happening, I even changed parent for this obj. without any help.
Bookmarks