The FolderListModel provides a model of the contents of a folder in a filesystem. More...
FolderListModel provides access to the local filesystem. The folder property specifies the folder to list.
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 Qt.labs.folderlistmodel module. Elements in the Qt.labs module are not guaranteed to remain compatible in future versions.
import Qt.labs.folderlistmodel 1.0
The roles available are:
Additionally a file entry can be differentiated from a folder entry via the isFolder() method.
folder : string |
The folder property holds the folder the model is currently providing.
It is a URL, but must be a file: or qrc: URL (or relative to such a URL).
The nameFilters property contains a list of filename filters. The filters may include the ? and * wildcards.
The example below filters on PNG and JPEG files:
FolderListModel { nameFilters: [ "*.png", "*.jpg" ] }
showDirs : bool |
If true (the default), directories are included in the model.
Note that the nameFilters are ignored for directories.
showDotAndDotDot : bool |
If true, the "." and ".." directories are included in the model.
The default is false.
showOnlyReadable : bool |
If true, only readable files and directories are shown.
The default is false.
Returns true if the entry index is a folder; otherwise returns false.