qfilesystemwatcher.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qfilesystemwatcher.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qfilesystemwatcher.h"-
35#include "qfilesystemwatcher_p.h"-
36-
37#ifndef QT_NO_FILESYSTEMWATCHER-
38-
39#include <qdatetime.h>-
40#include <qdebug.h>-
41#include <qdir.h>-
42#include <qfileinfo.h>-
43#include <qset.h>-
44#include <qtimer.h>-
45-
46#if defined(Q_OS_LINUX) || (defined(Q_OS_QNX) && !defined(QT_NO_INOTIFY))-
47#define USE_INOTIFY-
48#endif-
49-
50#include "qfilesystemwatcher_polling_p.h"-
51#if defined(Q_OS_WIN)-
52# include "qfilesystemwatcher_win_p.h"-
53#elif defined(USE_INOTIFY)-
54# include "qfilesystemwatcher_inotify_p.h"-
55#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS)-
56# include "qfilesystemwatcher_kqueue_p.h"-
57#elif defined(Q_OS_OSX)-
58# include "qfilesystemwatcher_fsevents_p.h"-
59#endif-
60-
61QT_BEGIN_NAMESPACE-
62-
63QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject *parent)-
64{-
65#if defined(Q_OS_WIN)-
66 return new QWindowsFileSystemWatcherEngine(parent);-
67#elif defined(USE_INOTIFY)-
68 // there is a chance that inotify may fail on Linux pre-2.6.13 (August-
69 // 2005), so we can't just new inotify directly.-
70 return QInotifyFileSystemWatcherEngine::create(parent);
executed 354 times by 10 tests: return QInotifyFileSystemWatcherEngine::create(parent);
Executed by:
  • tst_QApplication
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QSidebar
  • tst_languageChange
354
71#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS)-
72 return QKqueueFileSystemWatcherEngine::create(parent);-
73#elif defined(Q_OS_OSX)-
74 return QFseventsFileSystemWatcherEngine::create(parent);-
75#else-
76 Q_UNUSED(parent);-
77 return 0;-
78#endif-
79}-
80-
81QFileSystemWatcherPrivate::QFileSystemWatcherPrivate()-
82 : native(0), poller(0)-
83{-
84}
executed 354 times by 10 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QSidebar
  • tst_languageChange
354
85-
86void QFileSystemWatcherPrivate::init()-
87{-
88 Q_Q(QFileSystemWatcher);-
89 native = createNativeEngine(q);-
90 if (native) {
nativeDescription
TRUEevaluated 354 times by 10 tests
Evaluated by:
  • tst_QApplication
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QSidebar
  • tst_languageChange
FALSEnever evaluated
0-354
91 QObject::connect(native,-
92 SIGNAL(fileChanged(QString,bool)),-
93 q,-
94 SLOT(_q_fileChanged(QString,bool)));-
95 QObject::connect(native,-
96 SIGNAL(directoryChanged(QString,bool)),-
97 q,-
98 SLOT(_q_directoryChanged(QString,bool)));-
99 }
executed 354 times by 10 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QSidebar
  • tst_languageChange
354
100}
executed 354 times by 10 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QSidebar
  • tst_languageChange
354
101-
102void QFileSystemWatcherPrivate::initPollerEngine()-
103{-
104 if(poller)
pollerDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
4-5
105 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QFileSystemWatcher
5
106-
107 Q_Q(QFileSystemWatcher);-
108 poller = new QPollingFileSystemWatcherEngine(q); // that was a mouthful-
109 QObject::connect(poller,-
110 SIGNAL(fileChanged(QString,bool)),-
111 q,-
112 SLOT(_q_fileChanged(QString,bool)));-
113 QObject::connect(poller,-
114 SIGNAL(directoryChanged(QString,bool)),-
115 q,-
116 SLOT(_q_directoryChanged(QString,bool)));-
117}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
4
118-
119void QFileSystemWatcherPrivate::_q_fileChanged(const QString &path, bool removed)-
120{-
121 Q_Q(QFileSystemWatcher);-
122 if (!files.contains(path)) {
!files.contains(path)Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
0-28
123 // the path was removed after a change was detected, but before we delivered the signal-
124 return;
never executed: return;
0
125 }-
126 if (removed)
removedDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
12-16
127 files.removeAll(path);
executed 16 times by 1 test: files.removeAll(path);
Executed by:
  • tst_QFileSystemWatcher
16
128 emit q->fileChanged(path, QFileSystemWatcher::QPrivateSignal());-
129}
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
28
130-
131void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool removed)-
132{-
133 Q_Q(QFileSystemWatcher);-
134 if (!directories.contains(path)) {
!directories.contains(path)Description
TRUEnever evaluated
FALSEevaluated 64 times by 4 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
0-64
135 // perhaps the path was removed after a change was detected, but before we delivered the signal-
136 return;
never executed: return;
0
137 }-
138 if (removed)
removedDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 58 times by 4 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
6-58
139 directories.removeAll(path);
executed 6 times by 1 test: directories.removeAll(path);
Executed by:
  • tst_QFileSystemWatcher
6
140 emit q->directoryChanged(path, QFileSystemWatcher::QPrivateSignal());-
141}
executed 64 times by 4 tests: end of block
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
64
142-
143-
144-
145/*!-
146 \class QFileSystemWatcher-
147 \inmodule QtCore-
148 \brief The QFileSystemWatcher class provides an interface for monitoring files and directories for modifications.-
149 \ingroup io-
150 \since 4.2-
151 \reentrant-
152-
153 QFileSystemWatcher monitors the file system for changes to files-
154 and directories by watching a list of specified paths.-
155-
156 Call addPath() to watch a particular file or directory. Multiple-
157 paths can be added using the addPaths() function. Existing paths can-
158 be removed by using the removePath() and removePaths() functions.-
159-
160 QFileSystemWatcher examines each path added to it. Files that have-
161 been added to the QFileSystemWatcher can be accessed using the-
162 files() function, and directories using the directories() function.-
163-
164 The fileChanged() signal is emitted when a file has been modified,-
165 renamed or removed from disk. Similarly, the directoryChanged()-
166 signal is emitted when a directory or its contents is modified or-
167 removed. Note that QFileSystemWatcher stops monitoring files once-
168 they have been renamed or removed from disk, and directories once-
169 they have been removed from disk.-
170-
171 \note On systems running a Linux kernel without inotify support,-
172 file systems that contain watched paths cannot be unmounted.-
173-
174 \note Windows CE does not support directory monitoring by-
175 default as this depends on the file system driver installed.-
176-
177 \note The act of monitoring files and directories for-
178 modifications consumes system resources. This implies there is a-
179 limit to the number of files and directories your process can-
180 monitor simultaneously. On all BSD variants, for-
181 example, an open file descriptor is required for each monitored-
182 file. Some system limits the number of open file descriptors to 256-
183 by default. This means that addPath() and addPaths() will fail if-
184 your process tries to add more than 256 files or directories to-
185 the file system monitor. Also note that your process may have-
186 other file descriptors open in addition to the ones for files-
187 being monitored, and these other open descriptors also count in-
188 the total. \macos uses a different backend and does not-
189 suffer from this issue.-
190-
191-
192 \sa QFile, QDir-
193*/-
194-
195-
196/*!-
197 Constructs a new file system watcher object with the given \a parent.-
198*/-
199QFileSystemWatcher::QFileSystemWatcher(QObject *parent)-
200 : QObject(*new QFileSystemWatcherPrivate, parent)-
201{-
202 d_func()->init();-
203}
executed 354 times by 10 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QSidebar
  • tst_languageChange
354
204-
205/*!-
206 Constructs a new file system watcher object with the given \a parent-
207 which monitors the specified \a paths list.-
208*/-
209QFileSystemWatcher::QFileSystemWatcher(const QStringList &paths, QObject *parent)-
210 : QObject(*new QFileSystemWatcherPrivate, parent)-
211{-
212 d_func()->init();-
213 addPaths(paths);-
214}
never executed: end of block
0
215-
216/*!-
217 Destroys the file system watcher.-
218*/-
219QFileSystemWatcher::~QFileSystemWatcher()-
220{ }-
221-
222/*!-
223 Adds \a path to the file system watcher if \a path exists. The-
224 path is not added if it does not exist, or if it is already being-
225 monitored by the file system watcher.-
226-
227 If \a path specifies a directory, the directoryChanged() signal-
228 will be emitted when \a path is modified or removed from disk;-
229 otherwise the fileChanged() signal is emitted when \a path is-
230 modified, renamed or removed.-
231-
232 If the watch was successful, true is returned.-
233-
234 Reasons for a watch failure are generally system-dependent, but-
235 may include the resource not existing, access failures, or the-
236 total watch count limit, if the platform has one.-
237-
238 \note There may be a system dependent limit to the number of-
239 files and directories that can be monitored simultaneously.-
240 If this limit is been reached, \a path will not be monitored,-
241 and false is returned.-
242-
243 \sa addPaths(), removePath()-
244*/-
245bool QFileSystemWatcher::addPath(const QString &path)-
246{-
247 if (path.isEmpty()) {
path.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 481 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
1-481
248 qWarning("QFileSystemWatcher::addPath: path is empty");-
249 return true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QFileSystemWatcher
1
250 }-
251-
252 QStringList paths = addPaths(QStringList(path));-
253 return paths.isEmpty();
executed 481 times by 8 tests: return paths.isEmpty();
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
481
254}-
255-
256/*!-
257 Adds each path in \a paths to the file system watcher. Paths are-
258 not added if they not exist, or if they are already being-
259 monitored by the file system watcher.-
260-
261 If a path specifies a directory, the directoryChanged() signal-
262 will be emitted when the path is modified or removed from disk;-
263 otherwise the fileChanged() signal is emitted when the path is-
264 modified, renamed, or removed.-
265-
266 The return value is a list of paths that could not be watched.-
267-
268 Reasons for a watch failure are generally system-dependent, but-
269 may include the resource not existing, access failures, or the-
270 total watch count limit, if the platform has one.-
271-
272 \note There may be a system dependent limit to the number of-
273 files and directories that can be monitored simultaneously.-
274 If this limit has been reached, the excess \a paths will not-
275 be monitored, and they will be added to the returned QStringList.-
276-
277 \sa addPath(), removePaths()-
278*/-
279QStringList QFileSystemWatcher::addPaths(const QStringList &paths)-
280{-
281 Q_D(QFileSystemWatcher);-
282-
283 QStringList p = paths;-
284 QMutableListIterator<QString> it(p);-
285-
286 while (it.hasNext()) {
it.hasNext()Description
TRUEevaluated 487 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
FALSEevaluated 486 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
486-487
287 const QString &path = it.next();-
288 if (path.isEmpty())
path.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 486 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
1-486
289 it.remove();
executed 1 time by 1 test: it.remove();
Executed by:
  • tst_QFileSystemWatcher
1
290 }
executed 487 times by 8 tests: end of block
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
487
291-
292 if (p.isEmpty()) {
p.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 484 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
2-484
293 qWarning("QFileSystemWatcher::addPaths: list is empty");-
294 return QStringList();
executed 2 times by 1 test: return QStringList();
Executed by:
  • tst_QFileSystemWatcher
2
295 }-
296-
297 QFileSystemWatcherEngine *engine = 0;-
298-
299 const QString on = objectName();-
300-
301 if (!on.startsWith(QLatin1String("_qt_autotest_force_engine_"))) {
!on.startsWith...rce_engine_"))Description
TRUEevaluated 457 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
27-457
302 // Normal runtime case - search intelligently for best engine-
303 if(d->native) {
d->nativeDescription
TRUEevaluated 457 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
FALSEnever evaluated
0-457
304 engine = d->native;-
305 } else {
executed 457 times by 8 tests: end of block
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
457
306 d_func()->initPollerEngine();-
307 engine = d->poller;-
308 }
never executed: end of block
0
309-
310 } else {-
311 // Autotest override case - use the explicitly selected engine only-
312 const QStringRef forceName = on.midRef(26);-
313 if(forceName == QLatin1String("poller")) {
forceName == Q...ring("poller")Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
9-18
314 qDebug() << "QFileSystemWatcher: skipping native engine, using only polling engine";-
315 d_func()->initPollerEngine();-
316 engine = d->poller;-
317 } else if(forceName == QLatin1String("native")) {
executed 9 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
forceName == Q...ring("native")Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEnever evaluated
0-18
318 qDebug() << "QFileSystemWatcher: skipping polling engine, using only native engine";-
319 engine = d->native;-
320 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
18
321 }
executed 27 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
27
322-
323 if(engine)
engineDescription
TRUEevaluated 484 times by 8 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
FALSEnever evaluated
0-484
324 p = engine->addPaths(p, &d->files, &d->directories);
executed 484 times by 8 tests: p = engine->addPaths(p, &d->files, &d->directories);
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
484
325-
326 return p;
executed 484 times by 8 tests: return p;
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
484
327}-
328-
329/*!-
330 Removes the specified \a path from the file system watcher.-
331-
332 If the watch is successfully removed, true is returned.-
333-
334 Reasons for watch removal failing are generally system-dependent,-
335 but may be due to the path having already been deleted, for example.-
336-
337 \sa removePaths(), addPath()-
338*/-
339bool QFileSystemWatcher::removePath(const QString &path)-
340{-
341 if (path.isEmpty()) {
path.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 105 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
1-105
342 qWarning("QFileSystemWatcher::removePath: path is empty");-
343 return true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QFileSystemWatcher
1
344 }-
345-
346 QStringList paths = removePaths(QStringList(path));-
347 return paths.isEmpty();
executed 105 times by 5 tests: return paths.isEmpty();
Executed by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
105
348}-
349-
350/*!-
351 Removes the specified \a paths from the file system watcher.-
352-
353 The return value is a list of paths which were not able to be-
354 unwatched successfully.-
355-
356 Reasons for watch removal failing are generally system-dependent,-
357 but may be due to the path having already been deleted, for example.-
358-
359 \sa removePath(), addPaths()-
360*/-
361QStringList QFileSystemWatcher::removePaths(const QStringList &paths)-
362{-
363 Q_D(QFileSystemWatcher);-
364-
365 QStringList p = paths;-
366 QMutableListIterator<QString> it(p);-
367-
368 while (it.hasNext()) {
it.hasNext()Description
TRUEevaluated 108 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
FALSEevaluated 108 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
108
369 const QString &path = it.next();-
370 if (path.isEmpty())
path.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 107 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
1-107
371 it.remove();
executed 1 time by 1 test: it.remove();
Executed by:
  • tst_QFileSystemWatcher
1
372 }
executed 108 times by 5 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
108
373-
374 if (p.isEmpty()) {
p.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 106 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
2-106
375 qWarning("QFileSystemWatcher::removePaths: list is empty");-
376 return QStringList();
executed 2 times by 1 test: return QStringList();
Executed by:
  • tst_QFileSystemWatcher
2
377 }-
378-
379 if (d->native)
d->nativeDescription
TRUEevaluated 106 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
FALSEnever evaluated
0-106
380 p = d->native->removePaths(p, &d->files, &d->directories);
executed 106 times by 5 tests: p = d->native->removePaths(p, &d->files, &d->directories);
Executed by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
106
381 if (d->poller)
d->pollerDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 101 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
5-101
382 p = d->poller->removePaths(p, &d->files, &d->directories);
executed 5 times by 1 test: p = d->poller->removePaths(p, &d->files, &d->directories);
Executed by:
  • tst_QFileSystemWatcher
5
383-
384 return p;
executed 106 times by 5 tests: return p;
Executed by:
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_languageChange
106
385}-
386-
387/*!-
388 \fn void QFileSystemWatcher::fileChanged(const QString &path)-
389-
390 This signal is emitted when the file at the specified \a path is-
391 modified, renamed or removed from disk.-
392-
393 \sa directoryChanged()-
394*/-
395-
396/*!-
397 \fn void QFileSystemWatcher::directoryChanged(const QString &path)-
398-
399 This signal is emitted when the directory at a specified \a path-
400 is modified (e.g., when a file is added or deleted) or removed-
401 from disk. Note that if there are several changes during a short-
402 period of time, some of the changes might not emit this signal.-
403 However, the last change in the sequence of changes will always-
404 generate this signal.-
405-
406 \sa fileChanged()-
407*/-
408-
409/*!-
410 \fn QStringList QFileSystemWatcher::directories() const-
411-
412 Returns a list of paths to directories that are being watched.-
413-
414 \sa files()-
415*/-
416-
417/*!-
418 \fn QStringList QFileSystemWatcher::files() const-
419-
420 Returns a list of paths to files that are being watched.-
421-
422 \sa directories()-
423*/-
424-
425QStringList QFileSystemWatcher::directories() const-
426{-
427 Q_D(const QFileSystemWatcher);-
428 return d->directories;
executed 477 times by 8 tests: return d->directories;
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_languageChange
477
429}-
430-
431QStringList QFileSystemWatcher::files() const-
432{-
433 Q_D(const QFileSystemWatcher);-
434 return d->files;
executed 4 times by 1 test: return d->files;
Executed by:
  • tst_QFileSystemWatcher
4
435}-
436-
437QT_END_NAMESPACE-
438-
439#include "moc_qfilesystemwatcher.cpp"-
440-
441#endif // QT_NO_FILESYSTEMWATCHER-
442-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9