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";
fsWatcher = new QFileSystemWatcher();
fsWatcher->addPath( baseWay + "auth.log" );
QObject::connect(fsWatcher, SIGNAL( fileChanged(QString) ), this, SLOT( changed(QString) ));
}
After I change the document, the signal processes 2 times, although I saved the document and changed it 1 time.
void parser::changed(const QString &flName)
{
QFileInfo qfi(flName);
qDebug() << "name = " << flName << "size = " << qfi.size();
}
Why does QFileSystemWatcher give a signal 2 times?
Why does QFileInfo produce a zero size on the first request?
I edit the file Notepad ++
The problem was in the text editor and its methods of working with the file.