mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
Fix compilation with 5 <= qt < 5.4
This commit is contained in:
parent
5d8918f68f
commit
797bb2df14
@ -106,19 +106,13 @@ void FileMonitorGuard::refresh(bool new_file)
|
|||||||
bool exists = QFile(qfilename).exists();
|
bool exists = QFile(qfilename).exists();
|
||||||
#if (QT_VERSION >= 0x050000)
|
#if (QT_VERSION >= 0x050000)
|
||||||
if (!exists || !qwatcher_->addPath(qfilename)) {
|
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
|
#else
|
||||||
auto add_path = [&]() {
|
auto add_path = [&]() {
|
||||||
qwatcher_->addPath(qfilename);
|
qwatcher_->addPath(qfilename);
|
||||||
return qwatcher_->files().contains(qfilename);
|
return qwatcher_->files().contains(qfilename);
|
||||||
};
|
};
|
||||||
if (!exists || !add_path()) {
|
if (!exists || !add_path()) {
|
||||||
|
#endif
|
||||||
if (exists)
|
if (exists)
|
||||||
LYXERR(Debug::FILES,
|
LYXERR(Debug::FILES,
|
||||||
"Could not add path to QFileSystemWatcher: "
|
"Could not add path to QFileSystemWatcher: "
|
||||||
@ -127,7 +121,10 @@ void FileMonitorGuard::refresh(bool new_file)
|
|||||||
QTimer::singleShot(1000, this, SLOT(refreshTrue()));
|
QTimer::singleShot(1000, this, SLOT(refreshTrue()));
|
||||||
else
|
else
|
||||||
QTimer::singleShot(1000, this, SLOT(refreshFalse()));
|
QTimer::singleShot(1000, this, SLOT(refreshFalse()));
|
||||||
#endif
|
// Better (qt>=5.4):
|
||||||
|
/*QTimer::singleShot(1000, this, [=](){
|
||||||
|
refresh(new_file || !exists);
|
||||||
|
});*/
|
||||||
} else if (exists && new_file)
|
} else if (exists && new_file)
|
||||||
Q_EMIT fileChanged();
|
Q_EMIT fileChanged();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user