Qt 4.2.0-tp1, Linux, Windows
It seems I missed something but I can't get what.
What I do
In .h:
#include <QFileSystemWatcher>
...
...
#include <QFileSystemWatcher>
...
QString destDir;
QFileSystemWatcher *watcher;
...
To copy to clipboard, switch view to plain text mode
In .cpp:
...
if (!destDir.isEmpty()){
watcher->addPath(destDir);
}
...
destDir = QFileDialog::getExistingDirectory( this, "Select directory", QFileDialog::ShowDirsOnly);
if (!destDir.isEmpty()){
watcher->addPath(destDir);
}
To copy to clipboard, switch view to plain text mode
There are also slot connected to watcher's signal directoryChanged(const QString&). When I tried to do something with selected dir (remove for example) nothing happened. So I've decided to check what is going on with the next addition code:
...
if (!destDir.isEmpty()){
watcher->addPath(destDir);
for(int i = 0; i < watcher->directories().count(); ++i){
dirs.append(watcher->directories().at(i)).append("\n");
}
QMessageBoxEx::information(this, "debug", dirs);
}
...
destDir = QFileDialog::getExistingDirectory( this, "Select directory", QFileDialog::ShowDirsOnly);
if (!destDir.isEmpty()){
watcher->addPath(destDir);
QString dirs;
for(int i = 0; i < watcher->directories().count(); ++i){
dirs.append(watcher->directories().at(i)).append("\n");
}
QMessageBoxEx::information(this, "debug", dirs);
}
To copy to clipboard, switch view to plain text mode
And what I get
under Linux:
undefined reference to `QFileSystemWatcher::directories() const'
and under Windows:
undefined reference to `_imp___ZNK18QFileSystemWatcher11directoriesEv'
Bookmarks