summaryrefslogtreecommitdiffstats
path: root/src/imports/folderlistmodel
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2010-09-06 11:22:39 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2010-09-06 11:22:39 (GMT)
commit5cfc65d04858563e53987b224f36ee71356aa73c (patch)
treec930c2ed2163e84c71200bb0e616e74e45ac46ec /src/imports/folderlistmodel
parentcb80c41e7bced1877312468e7f65e3a561e7d161 (diff)
downloadQt-5cfc65d04858563e53987b224f36ee71356aa73c.zip
Qt-5cfc65d04858563e53987b224f36ee71356aa73c.tar.gz
Qt-5cfc65d04858563e53987b224f36ee71356aa73c.tar.bz2
Doc: Worked on two more elements, replacing an image.
Diffstat (limited to 'src/imports/folderlistmodel')
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp96
1 files changed, 72 insertions, 24 deletions
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index 6c38911..4983840 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -95,30 +95,61 @@ public:
/*!
\qmlclass FolderListModel QDeclarativeFolderListModel
\ingroup qml-working-with-data
- \brief The FolderListModel provides a model of the contents of a folder in a filesystem.
+ \brief The FolderListModel provides a model of the contents of a file system folder.
- FolderListModel provides access to the local filesystem. The \e folder property
- specifies the folder to list.
+ FolderListModel provides access to information about the contents of a folder
+ in the local file system, exposing a list of files to views and other data components.
- Qt uses "/" as a universal directory separator in the same way that "/" is
- used as a path separator in URLs. If you always use "/" as a directory
- separator, Qt will translate your paths to conform to the underlying
- operating system.
-
- This type is made available by importing the \c Qt.labs.folderlistmodel module.
- \e {Elements in the Qt.labs module are not guaranteed to remain compatible
+ \note This type is made available by importing the \c Qt.labs.folderlistmodel module.
+ \e{Elements in the Qt.labs module are not guaranteed to remain compatible
in future versions.}
\bold{import Qt.labs.folderlistmodel 1.0}
- The roles available are:
+ The \l folder property specifies the folder to access. Information about the
+ files and directories in the folder is supplied via the model's interface.
+ Components access names and paths via the following roles:
+
\list
\o fileName
\o filePath
\endlist
- Additionally a file entry can be differentiated from a folder entry
- via the \l isFolder() method.
+ Additionally a file entry can be differentiated from a folder entry via the
+ isFolder() method.
+
+ \section1 Filtering
+
+ Various properties can be set to filter the number of files and directories
+ exposed by the model.
+
+ The \l nameFilters property can be set to contain a list of wildcard filters
+ that are applied to names of files and directories, causing only those that
+ match the filters to be exposed.
+
+ Directories can be included or excluded using the \l showDirs property, and
+ navigation directories can also be excluded by setting the \l showDotAndDotDot
+ property to false.
+
+ It is sometimes useful to limit the files and directories exposed to those
+ that the user can access. The \l showOnlyReadable property can be set to
+ enable this feature.
+
+ \section1 Example Usage
+
+ The following example shows a FolderListModel being used to provide a list
+ of QML files in a \l ListView:
+
+ \snippet doc/src/snippets/declarative/folderlistmodel.qml 0
+
+ \section1 Path Separators
+
+ Qt uses "/" as a universal directory separator in the same way that "/" is
+ used as a path separator in URLs. If you always use "/" as a directory
+ separator, Qt will translate your paths to conform to the underlying
+ operating system.
+
+ \sa {QML Data Models}
*/
QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent)
@@ -168,9 +199,13 @@ int QDeclarativeFolderListModel::rowCount(const QModelIndex &parent) const
/*!
\qmlproperty string FolderListModel::folder
- The \a folder property holds the folder the model is currently providing.
+ The \a folder property holds a URL for the folder that the model is
+ currently providing.
- It is a URL, but must be a file: or qrc: URL (or relative to such a URL).
+ The value is a URL expressed as a string, and must be a \c file: or \c qrc:
+ URL, or a relative URL.
+
+ By default, the value is an invalid URL.
*/
QUrl QDeclarativeFolderListModel::folder() const
{
@@ -214,16 +249,18 @@ QUrl QDeclarativeFolderListModel::parentFolder() const
/*!
\qmlproperty list<string> FolderListModel::nameFilters
- The \a nameFilters property contains a list of filename filters.
+ The \a nameFilters property contains a list of file name filters.
The filters may include the ? and * wildcards.
The example below filters on PNG and JPEG files:
- \code
+ \qml
FolderListModel {
nameFilters: [ "*.png", "*.jpg" ]
}
- \endcode
+ \endqml
+
+ \note Directories are not excluded by filters.
*/
QStringList QDeclarativeFolderListModel::nameFilters() const
{
@@ -335,9 +372,14 @@ void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QM
/*!
\qmlproperty bool FolderListModel::showDirs
- If true (the default), directories are included in the model.
+ If true, directories are included in the model; otherwise only files
+ are included.
+
+ By default, this property is true.
- Note that the nameFilters are ignored for directories.
+ Note that the nameFilters are not applied to directories.
+
+ \sa showDotAndDotDot
*/
bool QDeclarativeFolderListModel::showDirs() const
{
@@ -357,9 +399,12 @@ void QDeclarativeFolderListModel::setShowDirs(bool on)
/*!
\qmlproperty bool FolderListModel::showDotAndDotDot
- If true, the "." and ".." directories are included in the model.
+ If true, the "." and ".." directories are included in the model; otherwise
+ they are excluded.
+
+ By default, this property is false.
- The default is false.
+ \sa showDirs
*/
bool QDeclarativeFolderListModel::showDotAndDotDot() const
{
@@ -379,9 +424,12 @@ void QDeclarativeFolderListModel::setShowDotAndDotDot(bool on)
/*!
\qmlproperty bool FolderListModel::showOnlyReadable
- If true, only readable files and directories are shown.
+ If true, only readable files and directories are shown; otherwise all files
+ and directories are shown.
+
+ By default, this property is false.
- The default is false.
+ \sa showDirs
*/
bool QDeclarativeFolderListModel::showOnlyReadable() const
{