Questions tagged [qfilesystemwatcher]

A QFileSystemWatcher is a class from the Qt toolkit which provides an interface for monitoring files and directories for modifications.

QFileSystemWatcher monitors the file system for changes to files and directories by watching a list of specified paths.

It emits signals whenever a file has been modified, renamed or removed from disk, or when a directory or its contents is modified or removed.

The official Qt documenation can be found here for Qt 4.8 or here for Qt 5.

47 questions
0
votes
0 answers

How to use QFileSystemWatcher

I'd like to detect when a SDCARD or USB is inserted in my QT based linux embedded System. I made the following, but I think something is missing: FSwatcher = new QFileSystemWatcher(this); FSwatcher->addPath("/run/media"); …
LittleSaints
  • 391
  • 1
  • 6
  • 19
0
votes
1 answer

QFileSystemWatcher file changed signal emits only ones for few file update

I am using QFileSystemWatcher to control the log file changes. For creating and updating the log file I am using boost library. When I log few messages in one method file changing signal emits only ones (for last message), but I see that file…
Marseille
  • 134
  • 1
  • 7
0
votes
0 answers

Qt 4.7 QFileSystemWatcher example

i want to observe a path with the QFileSystemWatcher in QT 4.7. In QT 5.x work my program, but I don't know why it don't work in QT 4.7. QT 5.x QFileSystemWatcher watcher; watcher.addPath("myPath"); QStringList directoryList =…
achmed24
  • 49
  • 10
0
votes
1 answer

Why does QFileSystemWatcher emit multiple signals? and QFileInfo for the first time writes a zero file size

When a file is changed, the signal should fire 1 time, but for me it works several times. In setings function, I request size and it prints parser::parser(QObject *parent) : QObject(parent) { setings(); qDebug()<< baseWay <<"\n"; …
0
votes
1 answer

Cannot connect QFileSystemWatcher::directoryChanged to a lambda

As the title says, I'm trying to connect the QFileSystemWatcher::directoryChanged(const QString&) signal to a lambda, but when I compile it with g++ (7.2.1), I get the following error (abbreviated since SO won't let me post too much code): g++ -c…
JamesNZ
  • 187
  • 3
  • 7
0
votes
0 answers

QFileSystemWatcher directoryChanged signal emitted twice when file is deleted

I've some code to monitor a folder containing .xml files. I used a QFileSystemWatcher and connected the signal directoryChanged(const QString &path) to a slot where I implemented a small routine. When I delete a file which is located in this…
nmud
  • 175
  • 14
0
votes
2 answers

using QFileSystemWatcher::Files() to get file count of watched folder example? count is always 0?

I have tried to figure this out over the weekend, but to no avail. I cant seem to find an example using QFileSystemWatcher::Files() directly so i thought i would ask. I have a program that : lets the user select a 'source' folder. press a button…
joacampb
  • 177
  • 1
  • 18
0
votes
0 answers

Files not accessible in QFileSystemWatcher callback on Android

I created a simple watcher and added a path to it. I connected the watcher's signal to my method: void CssSetter::watchIfNeeded(const QString& newPath) { if(watcher==nullptr) { watcher = new QFileSystemWatcher(this); connect(watcher,…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
1 answer

PyQt, QFileSystemWatcher doesn't capture the file added

I need to monitor a certain folder and find out whether a new file is added to the folder, after that I ask the user whether they want to print the file out or not. The problem lies with the QFileSystemWatcher, I can't really figure out how to get…
Ivan Bilan
  • 2,379
  • 5
  • 38
  • 58
0
votes
2 answers

WinEvent Logs and QFileSystemWatcher

I try to add WinEvent Logs Windows7 to QFileSystemWatcher.However, addPath() method return false value. qDebug() << m_watcher->addPath("C:/Windows/System32/winevt/Logs/Application.evtx"); // false The same i get after trying to add winevt…
t3ft3l--i
  • 1,372
  • 1
  • 14
  • 21
0
votes
1 answer

QFileSystemWatcher::files() doesn't return a list of files

I'm using QFileSystemWatcher for watching for changes in a directory that I set in watcher->addPath("myPath") method. When I call watcher->directories() I see myPath. But when I call watcher->files() I see nothing. I thought I will see files in…
bin-bin
  • 532
  • 2
  • 6
  • 16
0
votes
1 answer

QFileSystemWatcher locks directory on Windows

I am watching a directory recursively using QFileSystemWatcher. And I am not able to rename/delete the parent directory either programmatically or manually if its sub directories are being watched. When trying to rename manually through system i get…
Neha
  • 1,751
  • 14
  • 36
0
votes
0 answers

How to catch file close event in python

Using python 2.7 on windows 7 64 bit machine. How to get a file close event: when file is opened in a new process of file opener (like notepad, wordpad which opens file everytime in new process of wordpad) when file is opened in a tab of file…
imp
  • 1,967
  • 2
  • 28
  • 40
0
votes
1 answer

C++ Qt 5.0.2 QFileSystemWatcher on Windows not seeing directory changes

I have an issue with QFileSystemWatcher from Qt 5.0.2 on Windows. test.cpp ... QFileSystemWatcher watcher; watcher.addPath("C:/data/watch"); QStringList directoryList = watcher.directories(); Q_FOREACH(QString directory, directoryList) qDebug()…
alexg
  • 902
  • 11
  • 37
0
votes
1 answer

QFileSystemWatcher::addPath recursively

Hi all I want to use QFileSystemWatcher to watch changes of a given directory and its subdirectory recursively, but void QFileSystemWatcher::addPath ( const QString & path ) didn't let me do it so is there any idea to do it easily or I should…
Oumaya
  • 655
  • 4
  • 18
  • 43