class KDirModel |
|
A model for a KIO-based directory tree.
KDirModel implements the QAbstractItemModel interface (for use with Qt's model/view widgets) around the directory listing for one directory or a tree of directories. See also KDirSortFilterProxyModel Author David Faure Based on work by Hamish Rodda and Pascal Letourneau |
|
parent - parent qobject |
|
|
Reimplemented from QAbstractItemModel. Returns true for empty directories. |
|
Reimplemented from QAbstractItemModel. Returns ColumnCount. |
|
Reimplemented from QAbstractItemModel. |
|
Return the directory lister used by this model. |
|
Reimplemented from QAbstractItemModel. Not implemented yet. |
|
Emitted for each subdirectory that is a parent of a url passed to expandToUrl This allows to asynchronously open a tree view down to a given directory. |
|
Lists subdirectories using fetchMore() as needed until the given url exists in the model.
When the model is used by a treeview, call KDirLister.openUrl with the base url of the tree, then the treeview will take care of calling fetchMore() when the user opens directories. However if you want the tree to show a given URL (i.e. open the tree recursively until that URL), call expandToUrl(). Note that this is asynchronous; the necessary listing of subdirectories will take time so the model will not immediately have this url available. The model emits the signal expand() when an index has become available; this can be connected to the treeview in order to let it open that index. url - the url of a subdirectory of the directory model |
|
Reimplemented from QAbstractItemModel. Lists the subdirectory. |
|
Reimplemented from QAbstractItemModel. |
|
Reimplemented from QAbstractItemModel. Returns true for directories. |
|
Reimplemented from QAbstractItemModel. Returns the column titles. |
|
Reimplemented from QAbstractItemModel. O(1) |
|
Return the index for a given kfileitem. This can be slow. Deprecated use the method that takes a KFileItem by value |
|
Return the index for a given kfileitem. This can be slow. |
|
Return the index for a given url. This can be slow. |
|
Notify the model that the item at this index has changed. For instance because KMimeTypeResolver called determineMimeType on it. This makes the model emit its dataChanged signal at this index, so that views repaint. Note that for most things (renaming, changing size etc.), KDirLister's signals tell the model already. |
|
Return the fileitem for a given index. This is O(1), i.e. fast. |
|
Reimplemented from QAbstractItemModel. |
|
Reimplemented from QAbstractItemModel. |
|
Reimplemented from QAbstractItemModel. |
|
Reimplemented from QAbstractItemModel. |
|
Reimplemented from QAbstractItemModel. Call this to set a new icon, e.g. a preview |
|
Set the directory lister to use by this model, instead of the default KDirLister created internally. The model takes ownership. |
|
Set whether dropping onto items should be allowed, and for which kind of item Drops are disabled by default. |
|
Reimplemented from QAbstractItemModel. Not implemented.
See also KDirSortFilterProxyModel |
Possible return value for data(ChildCountRole), meaning the item isn't a directory, or we haven't calculated its child count yet
FileItemRole | - 0x07A263FF | - | ||
ChildCountRole | - 0x2C4D0A40 | - |
returns the number of items in a directory, or ChildCountUnknown
NoDrops | - 0 | - | ||
DropOnDirectory | - 1 | - | ||
DropOnAnyFile | - 2 | - | ||
DropOnLocalExecutable | - 4 | - |
* Useful "default" columns. Views can use a proxy to have more control over this.
Name | - 0 | - | ||
Size | - | - | ||
ModifiedTime | - | - | ||
Permissions | - | - | ||
Owner | - | - | ||
Group | - | - | ||
Type | - | - | ||
ColumnCount | - | - |
Possible return value for data(ChildCountRole), meaning the item isn't a directory, or we haven't calculated its child count yet
ChildCountUnknown | - -1 | - |