Qt:Документация 4.3.2/qfilesystemwatcher

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QFileSystemWatcher Class Reference
[модуль QtCore ]

The QFileSystemWatcher class provides an interface for monitoring files and directories for modifications. Далее...

 #include <QFileSystemWatcher>

Inherits QObject.

Примечание: все функции в этом классе реентерабельны.

Класс был добавлен в Qt 4.2.

[править] Открытые функции

  • 29 открытых функций, унаследованных от QObject

[править] Сигналы

  • 1 сигнал, унаследованный от QObject

[править] Дополнительные унаследованные члены

  • 1 свойство, унаследованное от QObject
  • 1 открытый слот, унаследованный от QObject
  • 5 статических открытых членов, унаследованных от QObject
  • 7 защищенных функций, унаследованных от QObject

[править] Подробное описание

The QFileSystemWatcher class provides an interface for monitoring files and directories for modifications.

QFileSystemWatcher monitors the file system for changes to files and directories by watching a list of specified paths.

Call addPath() to watch a particular file or directory. Multiple paths can be added using the addPaths() function. Existing paths can be removed by using the removePath() and removePaths() functions.

QFileSystemWatcher examines each path added to it. Files that have been added to the QFileSystemWatcher can be accessed using the files() function, and directories using the directories() function.

The fileChanged() signal is emitted when a file has been modified or removed from disk. Similarly, the directoryChanged() signal is emitted when a directory or its contents is modified or removed. Note that QFileSystemWatcher stops monitoring files and directories once they have been removed from disk.

See also QFile and QDir.


[править] Описание функций-членов

[править]
QFileSystemWatcher::QFileSystemWatcher ( QObject * parent = 0 )

Constructs a new file system watcher object with the given parent.

[править]
QFileSystemWatcher::QFileSystemWatcher ( const QStringList & paths, QObject * parent = 0 )

Constructs a new file system watcher object with the given parent which monitors the specified paths list.

[править]
QFileSystemWatcher::~QFileSystemWatcher ()

Destroys the file system watcher.

[править]
void QFileSystemWatcher::addPath ( const QString & path )

Adds path to the file system watcher if path exists. The path is not added if it does not exist, or if it is already being monitored by the file system watcher.

If path specifies a directory, the directoryChanged() signal will be emitted when path is modified or removed from disk; otherwise the fileChanged() signal is emitted when path is modified or removed.

See also addPaths() and removePath().

[править]
void QFileSystemWatcher::addPaths ( const QStringList & paths )

Adds each path in paths to the file system watcher. Paths are not added if they not exist, or if they are already being monitored by the file system watcher.

If a path specifies a directory, the directoryChanged() signal will be emitted when the path is modified or removed from disk; otherwise the fileChanged() signal is emitted when the path is modified or removed.

See also addPath() and removePaths().

[править]
QStringList QFileSystemWatcher::directories () const

Returns a list of paths to directories that are being watched.

See also files().

[править]
void QFileSystemWatcher::directoryChanged ( const QString & path ) [signal]

This signal is emitted when the directory at a specified path, is modified (e.g., when a file is added, modified or deleted) or removed from disk. Note that if there are several changes during a short period of time, some of the changes might not emit this signal. However, the last change in the sequence of changes will always generate this signal.

See also fileChanged().

[править]
void QFileSystemWatcher::fileChanged ( const QString & path ) [signal]

This signal is emitted when the file at the specified path is modified or removed from disk.

See also directoryChanged().

[править]
QStringList QFileSystemWatcher::files () const

Returns a list of paths to files that are being watched.

See also directories().

[править]
void QFileSystemWatcher::removePath ( const QString & path )

Removes the specified path from the file system watcher.

See also removePaths() and addPath().

[править]
void QFileSystemWatcher::removePaths ( const QStringList & paths )

Removes the specified paths from the file system watcher.

See also removePath() and addPaths().



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2