QFileSystemModel doesn't emit fileRenamed signal
-
I am trying to watch the changes in a directory using QFileSystemModel. Whenever I rename a file in the root path, only the directoryLoaded() signal is emitted. I want the fileRenamed() signal to be emitted so that I know which file is renamed to a new name. Here is my code:
model = new QFileSystemModel; model->setRootPath("C:/test/"); QObject::connect(model, SIGNAL(fileRenamed(const QString&, const QString&, const QString&)), this, SLOT(updateRename())); QObject::connect(model, SIGNAL(directoryLoaded(const QString&)), this, SLOT(loadDir()));
-
@yeakub said in QFileSystemModel doesn't emit fileRenamed signal:
QFileSystemModel only sends the signal if the file is renamed inside the model.
Well, yes, naturally.
If you are wanting to track external changes you are supposed to use QFileSystemWatcher.
-
@yeakub said in QFileSystemModel doesn't emit fileRenamed signal:
QFileSystemModel only sends the signal if the file is renamed inside the model.
Well, yes, naturally.
If you are wanting to track external changes you are supposed to use QFileSystemWatcher.