From 797bb2df147d6b5ac3ad1d5ca612657421ccb258 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Sat, 11 Mar 2017 22:21:11 +0100 Subject: [PATCH] Fix compilation with 5 <= qt < 5.4 --- src/support/FileMonitor.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/support/FileMonitor.cpp b/src/support/FileMonitor.cpp index 051bbbbe0f..bf53f379ed 100644 --- a/src/support/FileMonitor.cpp +++ b/src/support/FileMonitor.cpp @@ -106,19 +106,13 @@ void FileMonitorGuard::refresh(bool new_file) bool exists = QFile(qfilename).exists(); #if (QT_VERSION >= 0x050000) if (!exists || !qwatcher_->addPath(qfilename)) { - if (exists) - LYXERR(Debug::FILES, - "Could not add path to QFileSystemWatcher: " - << filename_); - QTimer::singleShot(1000, this, [=](){ - refresh(new_file || !exists); - }); #else auto add_path = [&]() { qwatcher_->addPath(qfilename); return qwatcher_->files().contains(qfilename); }; if (!exists || !add_path()) { +#endif if (exists) LYXERR(Debug::FILES, "Could not add path to QFileSystemWatcher: " @@ -127,7 +121,10 @@ void FileMonitorGuard::refresh(bool new_file) QTimer::singleShot(1000, this, SLOT(refreshTrue())); else QTimer::singleShot(1000, this, SLOT(refreshFalse())); -#endif + // Better (qt>=5.4): + /*QTimer::singleShot(1000, this, [=](){ + refresh(new_file || !exists); + });*/ } else if (exists && new_file) Q_EMIT fileChanged(); } -- 2.39.2