Sure, I use a single QFileSystemWatcher instance. My editor is multy-tabbed. When it opens a file, it add a file path to QFileSystemWatcher:
watcher.addPath (file_name);
When an editor closes a file, I remove the file path from QFileSystemWatcher.
Sure, I use a single QFileSystemWatcher instance. My editor is multy-tabbed. When it opens a file, it add a file path to QFileSystemWatcher:
watcher.addPath (file_name);
When an editor closes a file, I remove the file path from QFileSystemWatcher.
What does
output?Qt Code:
qDebug() << watcher.files() << watcher.directories();To copy to clipboard, switch view to plain text mode
J-P Nurmi
If I call it from my fileChanged-slot, I get this:
-----------
("/home/rox/devel/test/test.txt") ()
("/home/rox/devel/test/test.txt") ()
-----------
It's after saving test.txt once from the another, external editor.
Ok. What's the name of the slot? Perhaps you used the naming convention of automatic connections by accident?
on_objectName_signalName(...)
J-P Nurmi
My slot is named as "watcher_fileChanged". I have a class that manage text documets - document_holder. Withing that class I have a public slot document_holder::watcher_fileChanged (const QString & path).
At the document_holder constructor I call the "connect" method to connect a slot with a watcher:
connect(&watcher, SIGNAL(fileChanged(const QString &)), this, SLOT(watcher_fileChanged (const QString &)));
All that compiles under Linux. And Qt is 4.3.4
Bookmarks