diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-07-28 09:00:18 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-12-14 18:23:22 +0000 |
commit | 9e1b6b6e53d01bed76dc624e4b6c0d5f7748bf85 (patch) | |
tree | ba5bee4da7e35fa7184700ea4203540f1be1275e /src/widgets/dialogs/qfileinfogatherer_p.h | |
parent | 81b5155e8234747658d0cce210f205fd6c4736ff (diff) |
QFileSystemModel: Enable experimental code path for per-file watching
QFileSystemModel had a #ifdefed out experimental code path for watching
single files to track changes in size, which got outdated over time.
Replace the #ifdef 0 by a check for the environment variable
QT_FILESYSTEMMODEL_WATCH_FILES, fix it up and apply some fixes to
related code to make it work:
- Split file names signaled by QFileSystemWatcher on '/' always.
- Do not instantiate QDirIterator on "", which means "current directory"
and results in mixed-up directories.
- Check on lastModified() in QExtendedInformation::operator==() so
that changes trigger an update in _q_fileSystemChanged().
- Fix the #ifdefed out part to compile and not to add directories
to the watcher.
[ChangeLog][QtWidgets][QFileSystemModel] It is now possible to enable
per-file watching by setting the environment variable
QT_FILESYSTEMMODEL_WATCH_FILES, allowing to track for example
changes in file size.
Task-number: QTBUG-46684
Change-Id: Ia5da9170866416c9529251f889814b23d7a7d069
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/widgets/dialogs/qfileinfogatherer_p.h')
-rw-r--r-- | src/widgets/dialogs/qfileinfogatherer_p.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h index 52578126de..0cf2ed1f58 100644 --- a/src/widgets/dialogs/qfileinfogatherer_p.h +++ b/src/widgets/dialogs/qfileinfogatherer_p.h @@ -84,7 +84,8 @@ public: bool operator ==(const QExtendedInformation &fileInfo) const { return mFileInfo == fileInfo.mFileInfo && displayType == fileInfo.displayType - && permissions() == fileInfo.permissions(); + && permissions() == fileInfo.permissions() + && lastModified() == fileInfo.lastModified(); } #ifndef QT_NO_FSFILEENGINE |