πŸ“ FolderTreeModel

folderTreeModel

FolderTreeModel mimic the API of FolderListModel but already exposed for a TreeView.

QaterialOnline

FolderTreeModel

Properties

Property Type Default Description
path url empty The path property holds a URL for the folder that the model currently provides.
nameFilters stringlist empty The nameFilters property contains a list of file name filters. The filters may include the ? and * wildcards. Example : nameFilters: ["*.png", "*.jpg"]
caseSensitive bool true Use case sensitive pattern matching.
showDrives bool true If true, drives are included in the model.
showDirs bool true If true, directories are included in the model; otherwise only files are included.
showFiles bool true If true, files are included in the model; otherwise only directories are included.
showDirsFirst bool true If true, if directories are included in the model they will always be shown first, then the files.
showDot bool false If true, the β€œ.” directory is included in the model; otherwise it is excluded.
showDotDot bool false If true, the β€œ..” directory is included in the model; otherwise it is excluded.
showDotAndDotDot bool false If true, the β€œ.” and β€œ..” directories are included in the model; otherwise they are excluded.
showHidden bool false If true, hidden files and directories are included in the model; otherwise they are excluded.
showOnlyReadable bool false If true, only readable files and directories are shown; otherwise all files and directories are shown.
sortCaseSensitive bool true If set to true, the sort is case sensitive. This property is true by default.
sortReversed bool false If set to true, reverses the sort order. The default is false.
sortField int Unsorted The sortField property contains field to use for sorting. sortField may be one of:
- FolderTreeModel.Unsorted
- FolderTreeModel.Name
- FolderTreeModel.Time
- FolderTreeModel.Size
- FolderTreeModel.Type
status int Null This property holds the status of folder reading. It can be one of:
- FolderTreeModel.Null - no folder has been set
- FolderTreeModel.Ready - the folder has been loaded
- FolderTreeModel.Loading - the folder is currently being loaded

Readonly Properties

Property Type Description
fileName string Returns the name of the file, excluding the path.
filePath string Returns the file name, including the path (which is absolute).
fileBaseName string Returns the base name of the file without the path.
The base name consists of all characters in the file up to (but not including) the first β€˜.’ character.
Example : β€œ/tmp/archive.tar.gz” baseName is β€œarchive”
The base name of a file is computed equally on all platforms, independent of file naming conventions (e.g., β€œ.bashrc” on Unix has an empty base name, and the suffix is β€œbashrc”).
fileCompleteBaseName string Returns the complete base name of the file without the path.
The complete base name consists of all characters in the file up to (but not including) the last β€˜.’ character.
Example : β€œ/tmp/archive.tar.gz” baseName is β€œarchive.tar”
fileSuffix string Returns the suffix (extension) of the file.
The suffix consists of all characters in the file after (but not including) the last β€˜.’.
Example : β€œ/tmp/archive.tar.gz” return β€œgz”
The suffix of a file is computed equally on all platforms, independent of file naming conventions (e.g., β€œ.bashrc” on Unix has an empty base name, and the suffix is β€œbashrc”).
fileCompleteSuffix string Returns the complete suffix (extension) of the file.
The complete suffix consists of all characters in the file after(but not including) the first β€˜.’.
Example : β€œ/tmp/archive.tar.gz” return β€œtar.gz”
fileSize int64 Returns the file size in bytes. If the file does not exist or cannot be fetched, 0 is returned.
If the file is a symlink, the size of the target file is returned (not the symlink).
fileModified date Returns the date and local time when the file was last modified.
If the file is a symlink, the time of the target file is returned (not the symlink).
fileAccessed date Returns the date and local time when the file was last read (accessed).
On platforms where this information is not available, returns the same as fileModified().
If the file is a symlink, the time of the target file is returned (not the symlink).
fileIsDir bool Returns true if this object points to a directory or to a symbolic link to a directory; otherwise returns false.
If the file is a symlink, this function returns true if the target is a directory (not the symlink).

Api

By default the model isn’t populated, it’s up to the user to explicitly call fetch.

Warning : For now the code is only run in main thread. This will result in ui freeze.

FolderTreeView

FolderTreeView provide a TreeView ready to explore a folder and subfolder. The default itemDelegate is a FolderTreeViewItem.

QaterialOnline