Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QDirModel class provides a data model for the local filesystem. More...
#include <QDirModel>
Inherits QAbstractItemModel.
The QDirModel class provides a data model for the local filesystem.
This class provides access to the local filesystem, providing functions for renaming and removing files and directories, and for creating new directories. In the simplest case, it can be used with a suitable display widget as part of a browser or filer.
QDirModel does not store file information internally or cache file data.
A directory model that displays the contents of a default directory is constructed with a QDir to supply the file infomation, and a parent object:
QDirModel *model = new QDirModel(QDir(), parent);
A tree view can be used to display the contents of the model:
QTreeView *treeView = new QTreeView(window); treeView->setModel(model);
QDirModel 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(), and the model will be automatically updated to take the changes into account.
See also nameFilters(), setFilter(), filter(), Model/View Programming, QListView, and QTreeView.
\bried
Whether the directory model allows writing to the file system
If this property is set to false, the directory model will allow renaming, copying and deleting of files and directories.
This property is true by default
Access functions:
This property holds whether the directory model should resolve symbolic links.
This is only relevant on operating systems that support symbolic links.
Access functions:
Constructs a new directory model with the given parent. The model initially contains information about the directory specified by path. Only those files matching the nameFilters and the filter are included in the model. The sort order is given by sorting.
Constructs a directory model of the directory with a parent object.
Destroys this directory model.
Returns the number of columns in the parent model item.
Reimplemented from QAbstractItemModel.
Returns the data for the model item index with the given role.
Reimplemented from QAbstractItemModel.
Returns true if this directory model (whose parent is parent), can decode drop event e.
Reimplemented from QAbstractItemModel.
Returns the file information for the model item index.
Returns the filter specification for the directory model.
See also QDir::Filters.
###
Reimplemented from QAbstractItemModel.
Returns true if the parent model item has children; otherwise returns false.
Reimplemented from QAbstractItemModel.
Returns the data for the header section section, role role.
Reimplemented from QAbstractItemModel.
Returns the icons for the item stored in the model under the given index.
Returns the file icon provider for this directory model.
Returns the model item index for the item in the parent with the given row and column.
Reimplemented from QAbstractItemModel.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the model item index for the given path.
Returns true if the model item index represents a directory; otherwise returns false.
Reimplemented from QAbstractItemModel.
Reimplemented from QAbstractItemModel.
Create a directory with the name in the parent model item.
Returns the name of the item stored in the model under the index given.
Returns a list of filters applied to the names in the model.
Return the parent of the given child model item.
Reimplemented from QAbstractItemModel.
Returns the path of the item stored in the model under the index given.
Refreshes (rereads) the children of parent.
Removes the model item index from the directory model, returning true if successful. If the item cannot be removed, false is returned.
Removes the directory corresponding to the model item index in the directory model, returning true if successful. If the directory cannot be removed, false is returned.
Returns the number of rows in the parent model item.
Reimplemented from QAbstractItemModel.
Sets the data for the model item index with the given role to the data referenced by the value. Returns true if successful; otherwise returns false.
Reimplemented from QAbstractItemModel.
Sets the directory model's filter to that specified by spec.
See also QDir::Filters.
Sets the provider of file icons for the directory model.
Sets the name filters for the directory model.
Sets the directory model's sorting order to that specified by spec.
See also QDir::SortFlags.
Sort the model items in the column using the order given. The order is a value defined in Qt::SortOrder.
Reimplemented from QAbstractItemModel.
Returns the sorting method used for the directory model.
See also QDir::SortFlags.
Reimplemented from QAbstractItemModel.
Copyright © 2004 Trolltech | Trademarks | Qt 4.0.0-b1 |