Regularly check if preview is modified when visible on screen

In case one cannot rely on QFileSystemWatcher.
This commit is contained in:
Guillaume Munch 2017-03-19 14:41:54 +01:00
parent ad16347b08
commit ac6d3ffb6a
2 changed files with 3 additions and 2 deletions

View File

@ -292,6 +292,7 @@ void RenderMonitoredPreview::draw(PainterInfo & pi, int x, int y) const
{ {
RenderPreview::draw(pi, x, y); RenderPreview::draw(pi, x, y);
startMonitoring(); startMonitoring();
monitor_->checkModifiedAsync();
} }
@ -311,7 +312,7 @@ bool RenderMonitoredPreview::monitoring() const
void RenderMonitoredPreview::startMonitoring() const void RenderMonitoredPreview::startMonitoring() const
{ {
if (!monitoring()) { if (!monitoring()) {
monitor_ = FileSystemWatcher::monitor(filename_); monitor_ = FileSystemWatcher::activeMonitor(filename_);
monitor_->connect(changed_); monitor_->connect(changed_);
} }
} }

View File

@ -134,7 +134,7 @@ private:
/// This signal is emitted if the file is modified /// This signal is emitted if the file is modified
ChangedSig changed_; ChangedSig changed_;
/// ///
mutable support::FileMonitorPtr monitor_; mutable support::ActiveFileMonitorPtr monitor_;
/// ///
support::FileName filename_; support::FileName filename_;
}; };