百度AI回答:
只能触发一次,如果需要持续触发,需要在处理完触发后,再次添加路径。
const QString filepath_bookmark = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/gtk-3.0/bookmarks";
QFileSystemWatcher *watcher = new QFileSystemWatcher;
watcher->addPath(filepath_bookmark);
connect(watcher, &QFileSystemWatcher::fileChanged, [=]{
genBookmark();
watcher->addPath(filepath_bookmark);
});