Yes, you can say that i am monitoring a log program.
make a simple dialog program with three pushbuttons.
I made the small test program, the watcher emit the signal when I first create the file, even before i write or close it.
void MainWindow::on_pushButton_open_clicked()
{
//open
file.setFileName("/home/test/log/test.log.txt");
tr("Cannot write file %1:\n%2.")
.arg("Test File")
.arg(file.errorString()));
return;
}
if (file.isOpen())
{
qDebug() << "file is opened";
}
// the signal is emitted, before i write or close the file.
}
void MainWindow::on_pushButton_open_clicked()
{
//open
file.setFileName("/home/test/log/test.log.txt");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::warning(this, tr("Warning: Test File"),
tr("Cannot write file %1:\n%2.")
.arg("Test File")
.arg(file.errorString()));
return;
}
if (file.isOpen())
{
qDebug() << "file is opened";
}
// the signal is emitted, before i write or close the file.
}
To copy to clipboard, switch view to plain text mode
so this make things even more strange to me, why the signal is not emitted when the other application is running ?
the exact scenario is,
I run another application_1 using my GUI_Application using Qprocess.
after the application_1 is stared, it generates log files , where you can see the progress and the results.
In my GUI_Application i watch the directory, using QFileSystemModel, where all the log files are generated.
but the watcher does not emit signal when the log files are generated. IDK why?? The signal is not emitted even when the application_1, which write the log files, is finished.
Bookmarks