Is there a way to initiate an action if the file is in the specified directory (or in a subfolder) without selecting all modification times each time? I ask because I have to check this live
You need to use QFileSystemWatcher.
More importantly, this is the signal you need to connect to:
void QFileSystemWatcher :: fileChanged (const QString and path) [signal]This signal is emitted when the file at the specified path is changed, renamed or deleted from the disk.See also directoryChanged ().
void QFileSystemWatcher :: fileChanged (const QString and path) [signal]
This signal is emitted when the file at the specified path is changed, renamed or deleted from the disk.
See also directoryChanged ().
So you can write something like this in your class or function:
... QFileSystemWatcher watcher; watcher.addPath("/My/Path/To/The/File"); QObject::connect(&watcher, SIGNAL(fileChanged(const QString&)), receiver, SLOT(handleFileChanged(const QString&))); ...
You are looking for a QFileSystemWatcher .