diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-03 17:11:17 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-03 17:11:17 (GMT) |
commit | 671eb89e41c90cc4cb11eca1c76181d1186db2b2 (patch) | |
tree | 4147f55e1596dc93bb972436130729d657713d24 /src/gui/dialogs | |
parent | d5f33087eca066d70240e272d4109c5cca8001cf (diff) | |
parent | 18b6067fa99004d1572e3d6b8fbc181729ad96be (diff) | |
download | Qt-671eb89e41c90cc4cb11eca1c76181d1186db2b2.zip Qt-671eb89e41c90cc4cb11eca1c76181d1186db2b2.tar.gz Qt-671eb89e41c90cc4cb11eca1c76181d1186db2b2.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/doc-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/doc-staging:
qdoc: Added next and previous links to top of pages.
Doc: style tuning
Doc: fixing style - tool buttons to bold.
Doc: updating the template to support search feature better.
Doc: Fixing columns to display all elements in lists - css3
Doc: fixing bugs in style
Doc: fixing style for search display and slim fit menus
Doc: Fixing bug in sorting script for search results.
Doc: Fixed basic language.
Doc: Added Windows Vista to the trademark list.
Doc: Updated the Java trademark information.
Doc: Moved QFileSystemModel example code to the class documentation.
Doc: Corrected the name property as it was incorrectly declared.
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/qfilesystemmodel.cpp | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 8a6190f..8a9f8ae 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -80,11 +80,43 @@ QT_BEGIN_NAMESPACE directories. In the simplest case, it can be used with a suitable display widget as part of a browser or filter. - QFileSystemModel will not fetch any files or directories until setRootPath + QFileSystemModel can be accessed using the standard interface provided by + QAbstractItemModel, but it also provides some convenience functions that are + specific to a directory model. + The fileInfo(), isDir(), name(), and path() functions provide information + about the underlying files and directories related to items in the model. + Directories can be created and removed using mkdir(), rmdir(). + + \note QFileSystemModel requires an instance of a GUI application. + + \section1 Example Usage + + A directory model that displays the contents of a default directory + is usually constructed with a parent object: + + \snippet doc/src/snippets/shareddirmodel/main.cpp 2 + + A tree view can be used to display the contents of the model + + \snippet doc/src/snippets/shareddirmodel/main.cpp 4 + + and the contents of a particular directory can be displayed by + setting the tree view's root index: + + \snippet doc/src/snippets/shareddirmodel/main.cpp 7 + + The view's root index can be used to control how much of a + hierarchical model is displayed. QDirModel provides a convenience + function that returns a suitable model index for a path to a + directory within the model. + + \section1 Caching and Performance + + QFileSystemModel will not fetch any files or directories until setRootPath() is called. This will prevent any unnecessary querying on the file system until that point such as listing the drives on Windows. - Unlike the QDirModel, QFileSystemModel uses a separate thread to populate + Unlike QDirModel, QFileSystemModel uses a separate thread to populate itself so it will not cause the main thread to hang as the file system is being queried. Calls to rowCount() will return 0 until the model populates a directory. @@ -92,15 +124,6 @@ QT_BEGIN_NAMESPACE QFileSystemModel keeps a cache with file information. The cache is automatically kept up to date using the QFileSystemWatcher. - QFileSystemModel can be accessed using the standard interface provided by - QAbstractItemModel, but it also provides some convenience functions that are - specific to a directory model. - The fileInfo(), isDir(), name(), and path() functions provide information - about the underlying files and directories related to items in the model. - Directories can be created and removed using mkdir(), rmdir(). - - \note QFileSystemModel requires an instance of a GUI application. - \sa {Model Classes} */ |