为什么 QFileSystemWatcher 会发出多个信号?而 QFileInfo 首次写入零文件大小
Why does QFileSystemWatcher emit multiple signals? and QFileInfo for the first time writes a zero file size
当文件被更改时,信号应该触发 1 次,但对我来说它工作了几次。
在设置功能中,我要求尺寸,打印
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) ));
}
更改文档后,信号处理 2 次,尽管我保存了文档并更改了 1 次。
void parser::changed(const QString &flName)
{
QFileInfo qfi(flName);
qDebug() << "name = " << flName << "size = " << qfi.size();
}
为什么QFileSystemWatcher会发出2次信号?
为什么 QFileInfo 在第一个请求上生成零大小?
我编辑文件记事本++
问题出在文本编辑器及其处理文件的方法上。
相关文章:
- 读取某些文件时出现分段错误,似乎与文件大小无关
- 构建挂起,即使是适度的文件大小
- 如何在Windows内核中获取文件大小
- 为什么 QFileSystemWatcher 会发出多个信号?而 QFileInfo 首次写入零文件大小
- 使用 C++ iOS::ate 获取错误的文件大小
- 相同的源代码,不同的可执行文件大小?
- 为什么未关闭的文件大小为 4 字节
- 读取二进制文件大小的短自上周以来停止工作
- 如何减小C++标准库libstdc++.so文件大小
- 文件大小和缓冲区过冲
- 如何从范围 v3 的istream_range中检索文件大小?
- 如何使用直接IO编写一个带有扩展文件大小的小文件
- 如何使用文件系统库获取"true"文件大小?(C++17)
- 如何限制文件大小,以便我的程序在变大之后创建一个新文件?并编辑新创建的文件的名称
- 如何使用C 17获取文件大小
- HttpQueryInfo 获取文件大小
- 二进制文件大小大于预期的 c++
- 如何计算预期的核心文件大小
- C :不正确的文件大小计算Winapi
- 减小 Wasm 文件大小(libc、optimization、emscripten)