Qt Reference Documentation

QML FolderListModel Element

The FolderListModel provides a model of the contents of a folder in a filesystem. More...

  • List of all members, including inherited members
  • Properties


    Detailed Description

    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:

    • fileName
    • filePath

    Additionally a file entry can be differentiated from a folder entry via the isFolder() method.

    Property Documentation

    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).

    nameFilters : list<string>

    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.

    Method Documentation

    bool FolderListModel::isFolder ( int index )

    Returns true if the entry index is a folder; otherwise returns false.


    Thank you for giving your feedback.

    Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

    [0]; s.parentNode.insertBefore(ga, s); })();