我想从控制台应用程序使用QFileSystemWatcher,按照我目前的方法,我没有收到任何被忽略的信号。谁能指出这个设置有什么问题吗?
static duk_ret_t automation_watch(duk_context *ctx)
{
int argc = 0; char** argv = 0;
QCoreApplication app(argc, argv);
bool retval = false;
QFileSystemWatcher *watcher = new QFileSystemWatcher(&app);
qDebug() << QDir::current().absolutePath();
watcher->addPath(QDir::current().absolutePath());
retval = QObject::connect(watcher, &QFileSystemWatcher::fileChanged, [](const QString& a) {
printf(a.toStdString().c_str());
printf("\r\n");
return 0;
});
assert(retval == true);
retval = QObject::connect(watcher, &QFileSystemWatcher::directoryChanged , [](const QString& a) {
printf(a.toStdString().c_str());
printf("\r\n");
return 0;
});
assert(retval == true);
app.exec();
return 0;
}