That looks about right, but there is a memory leak; the QFileSystemWatcher is never deallocated.