#[repr(C)]pub struct QDir { /* private fields */ }
Expand description
The QDir class provides access to directory structures and their contents.
C++ class: QDir
.
The QDir class provides access to directory structures and their contents.
A QDir is used to manipulate path names, access information regarding paths and files, and manipulate the underlying file system. It can also be used to access Qt's resource system.
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.
A QDir can point to a file using either a relative or an absolute path. Absolute paths begin with the directory separator (optionally preceded by a drive specification under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory.
Examples of absolute paths:
QDir(“/home/user/Documents”) QDir(“C:/Documents and Settings”)
On Windows, the second example above will be translated to C:\Documents and Settings
when used to access files.
Examples of relative paths:
QDir(“images/landscape.png”)
You can use the isRelative() or isAbsolute() functions to check if a QDir is using a relative or an absolute file path. Call makeAbsolute() to convert a relative QDir to an absolute one.
Implementations§
Source§impl QDir
impl QDir
Sourcepub unsafe fn absolute_file_path(
&self,
file_name: impl CastInto<Ref<QString>>,
) -> CppBox<QString>
pub unsafe fn absolute_file_path( &self, file_name: impl CastInto<Ref<QString>>, ) -> CppBox<QString>
Returns the absolute path name of a file in the directory. Does not check if the file actually exists in the directory; but see exists(). Redundant multiple separators or "." and ".." directories in fileName are not removed (see cleanPath()).
Calls C++ function: QString QDir::absoluteFilePath(const QString& fileName) const
.
Returns the absolute path name of a file in the directory. Does not check if the file actually exists in the directory; but see exists(). Redundant multiple separators or “.” and “..” directories in fileName are not removed (see cleanPath()).
See also relativeFilePath(), filePath(), and canonicalPath().
Sourcepub unsafe fn absolute_path(&self) -> CppBox<QString>
pub unsafe fn absolute_path(&self) -> CppBox<QString>
Returns the absolute path (a path that starts with "/" or with a drive specification), which may contain symbolic links, but never contains redundant ".", ".." or multiple separators.
Calls C++ function: QString QDir::absolutePath() const
.
Returns the absolute path (a path that starts with “/” or with a drive specification), which may contain symbolic links, but never contains redundant “.”, “..” or multiple separators.
See also setPath(), canonicalPath(), exists(), cleanPath(), dirName(), and absoluteFilePath().
Sourcepub unsafe fn add_resource_search_path(path: impl CastInto<Ref<QString>>)
pub unsafe fn add_resource_search_path(path: impl CastInto<Ref<QString>>)
Use QDir::addSearchPath() with a prefix instead.
Calls C++ function: static void QDir::addResourceSearchPath(const QString& path)
.
Use QDir::addSearchPath() with a prefix instead.
Adds path to the search paths searched in to find resources that are not specified with an absolute path. The default search path is to search only in the root (:/
).
See also The Qt Resource System.
Sourcepub unsafe fn add_search_path(
prefix: impl CastInto<Ref<QString>>,
path: impl CastInto<Ref<QString>>,
)
pub unsafe fn add_search_path( prefix: impl CastInto<Ref<QString>>, path: impl CastInto<Ref<QString>>, )
Adds path to the search path for prefix.
Calls C++ function: static void QDir::addSearchPath(const QString& prefix, const QString& path)
.
Adds path to the search path for prefix.
This function was introduced in Qt 4.3.
See also setSearchPaths().
Sourcepub unsafe fn canonical_path(&self) -> CppBox<QString>
pub unsafe fn canonical_path(&self) -> CppBox<QString>
Returns the canonical path, i.e. a path without symbolic links or redundant "." or ".." elements.
Calls C++ function: QString QDir::canonicalPath() const
.
Returns the canonical path, i.e. a path without symbolic links or redundant “.” or “..” elements.
On systems that do not have symbolic links this function will always return the same string that absolutePath() returns. If the canonical path does not exist (normally due to dangling symbolic links) canonicalPath() returns an empty string.
Example:
QString bin = “/local/bin”; // where /local/bin is a symlink to /usr/bin QDir binDir(bin); QString canonicalBin = binDir.canonicalPath(); // canonicalBin now equals “/usr/bin”
QString ls = “/local/bin/ls”; // where ls is the executable “ls” QDir lsDir(ls); QString canonicalLs = lsDir.canonicalPath(); // canonicalLS now equals “/usr/bin/ls”.
See also path(), absolutePath(), exists(), cleanPath(), dirName(), and absoluteFilePath().
Sourcepub unsafe fn cd(&self, dir_name: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn cd(&self, dir_name: impl CastInto<Ref<QString>>) -> bool
Changes the QDir's directory to dirName.
Calls C++ function: bool QDir::cd(const QString& dirName)
.
Changes the QDir’s directory to dirName.
Returns true
if the new directory exists; otherwise returns false
. Note that the logical cd() operation is not performed if the new directory does not exist.
Calling cd("..") is equivalent to calling cdUp().
See also cdUp(), isReadable(), exists(), and path().
Sourcepub unsafe fn cd_up(&self) -> bool
pub unsafe fn cd_up(&self) -> bool
Changes directory by moving one directory up from the QDir's current directory.
Calls C++ function: bool QDir::cdUp()
.
Changes directory by moving one directory up from the QDir’s current directory.
Returns true
if the new directory exists; otherwise returns false
. Note that the logical cdUp() operation is not performed if the new directory does not exist.
See also cd(), isReadable(), exists(), and path().
Sourcepub unsafe fn clean_path(path: impl CastInto<Ref<QString>>) -> CppBox<QString>
pub unsafe fn clean_path(path: impl CastInto<Ref<QString>>) -> CppBox<QString>
Returns path with directory separators normalized (converted to "/") and redundant ones removed, and "."s and ".."s resolved (as far as possible).
Calls C++ function: static QString QDir::cleanPath(const QString& path)
.
Returns path with directory separators normalized (converted to “/”) and redundant ones removed, and “.“s and “..“s resolved (as far as possible).
Symbolic links are kept. This function does not return the canonical path, but rather the simplest version of the input. For example, "./local" becomes "local", "local/../bin" becomes "bin" and "/local/usr/../bin" becomes "/local/bin".
See also absolutePath() and canonicalPath().
Sourcepub unsafe fn copy_from_q_dir(
&self,
arg1: impl CastInto<Ref<QDir>>,
) -> Ref<QDir>
pub unsafe fn copy_from_q_dir( &self, arg1: impl CastInto<Ref<QDir>>, ) -> Ref<QDir>
Sourcepub unsafe fn copy_from_q_string(
&self,
path: impl CastInto<Ref<QString>>,
) -> Ref<QDir>
pub unsafe fn copy_from_q_string( &self, path: impl CastInto<Ref<QString>>, ) -> Ref<QDir>
Calls C++ function: QDir& QDir::operator=(const QString& path)
.
Sourcepub unsafe fn count(&self) -> c_uint
pub unsafe fn count(&self) -> c_uint
Returns the total number of directories and files in the directory.
Calls C++ function: unsigned int QDir::count() const
.
Returns the total number of directories and files in the directory.
Equivalent to entryList().count().
See also operator[]() and entryList().
Sourcepub unsafe fn current() -> CppBox<QDir>
pub unsafe fn current() -> CppBox<QDir>
Returns the application's current directory.
Calls C++ function: static QDir QDir::current()
.
Returns the application’s current directory.
The directory is constructed using the absolute path of the current directory, ensuring that its path() will be the same as its absolutePath().
See also currentPath(), setCurrent(), home(), root(), and temp().
Sourcepub unsafe fn current_path() -> CppBox<QString>
pub unsafe fn current_path() -> CppBox<QString>
Returns the absolute path of the application's current directory. The current directory is the last directory set with QDir::setCurrent() or, if that was never called, the directory at which this application was started at by the parent process.
Calls C++ function: static QString QDir::currentPath()
.
Returns the absolute path of the application’s current directory. The current directory is the last directory set with QDir::setCurrent() or, if that was never called, the directory at which this application was started at by the parent process.
See also current(), setCurrent(), homePath(), rootPath(), tempPath(), and QCoreApplication::applicationDirPath().
Sourcepub unsafe fn dir_name(&self) -> CppBox<QString>
pub unsafe fn dir_name(&self) -> CppBox<QString>
Returns the name of the directory; this is not the same as the path, e.g. a directory with the name "mail", might have the path "/var/spool/mail". If the directory has no name (e.g. it is the root directory) an empty string is returned.
Calls C++ function: QString QDir::dirName() const
.
Returns the name of the directory; this is not the same as the path, e.g. a directory with the name “mail”, might have the path “/var/spool/mail”. If the directory has no name (e.g. it is the root directory) an empty string is returned.
No check is made to ensure that a directory with this name actually exists; but see exists().
See also path(), filePath(), absolutePath(), and absoluteFilePath().
Sourcepub unsafe fn drives() -> CppBox<QListOfQFileInfo>
pub unsafe fn drives() -> CppBox<QListOfQFileInfo>
Returns a list of the root directories on this system.
Calls C++ function: static QList<QFileInfo> QDir::drives()
.
Sourcepub unsafe fn entry_info_list_q_flags_filter_q_flags_sort_flag(
&self,
filters: QFlags<Filter>,
sort: QFlags<SortFlag>,
) -> CppBox<QListOfQFileInfo>
pub unsafe fn entry_info_list_q_flags_filter_q_flags_sort_flag( &self, filters: QFlags<Filter>, sort: QFlags<SortFlag>, ) -> CppBox<QListOfQFileInfo>
This is an overloaded function.
Calls C++ function: QList<QFileInfo> QDir::entryInfoList(QFlags<QDir::Filter> filters = …, QFlags<QDir::SortFlag> sort = …) const
.
This is an overloaded function.
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The attribute filter and sorting specifications can be overridden using the filters and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryList(), setNameFilters(), setSorting(), setFilter(), isReadable(), and exists().
Sourcepub unsafe fn entry_info_list_q_string_list_q_flags_filter_q_flags_sort_flag(
&self,
name_filters: impl CastInto<Ref<QStringList>>,
filters: QFlags<Filter>,
sort: QFlags<SortFlag>,
) -> CppBox<QListOfQFileInfo>
pub unsafe fn entry_info_list_q_string_list_q_flags_filter_q_flags_sort_flag( &self, name_filters: impl CastInto<Ref<QStringList>>, filters: QFlags<Filter>, sort: QFlags<SortFlag>, ) -> CppBox<QListOfQFileInfo>
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
Calls C++ function: QList<QFileInfo> QDir::entryInfoList(const QStringList& nameFilters, QFlags<QDir::Filter> filters = …, QFlags<QDir::SortFlag> sort = …) const
.
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The name filter, file attribute filter, and sorting specification can be overridden using the nameFilters, filters, and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryList(), setNameFilters(), setSorting(), setFilter(), isReadable(), and exists().
Sourcepub unsafe fn entry_info_list_q_flags_filter(
&self,
filters: QFlags<Filter>,
) -> CppBox<QListOfQFileInfo>
pub unsafe fn entry_info_list_q_flags_filter( &self, filters: QFlags<Filter>, ) -> CppBox<QListOfQFileInfo>
This is an overloaded function.
Calls C++ function: QList<QFileInfo> QDir::entryInfoList(QFlags<QDir::Filter> filters = …) const
.
This is an overloaded function.
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The attribute filter and sorting specifications can be overridden using the filters and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryList(), setNameFilters(), setSorting(), setFilter(), isReadable(), and exists().
Sourcepub unsafe fn entry_info_list(&self) -> CppBox<QListOfQFileInfo>
pub unsafe fn entry_info_list(&self) -> CppBox<QListOfQFileInfo>
This is an overloaded function.
Calls C++ function: QList<QFileInfo> QDir::entryInfoList() const
.
This is an overloaded function.
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The attribute filter and sorting specifications can be overridden using the filters and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryList(), setNameFilters(), setSorting(), setFilter(), isReadable(), and exists().
Sourcepub unsafe fn entry_info_list_q_string_list_q_flags_filter(
&self,
name_filters: impl CastInto<Ref<QStringList>>,
filters: QFlags<Filter>,
) -> CppBox<QListOfQFileInfo>
pub unsafe fn entry_info_list_q_string_list_q_flags_filter( &self, name_filters: impl CastInto<Ref<QStringList>>, filters: QFlags<Filter>, ) -> CppBox<QListOfQFileInfo>
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
Calls C++ function: QList<QFileInfo> QDir::entryInfoList(const QStringList& nameFilters, QFlags<QDir::Filter> filters = …) const
.
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The name filter, file attribute filter, and sorting specification can be overridden using the nameFilters, filters, and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryList(), setNameFilters(), setSorting(), setFilter(), isReadable(), and exists().
Sourcepub unsafe fn entry_info_list_q_string_list(
&self,
name_filters: impl CastInto<Ref<QStringList>>,
) -> CppBox<QListOfQFileInfo>
pub unsafe fn entry_info_list_q_string_list( &self, name_filters: impl CastInto<Ref<QStringList>>, ) -> CppBox<QListOfQFileInfo>
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
Calls C++ function: QList<QFileInfo> QDir::entryInfoList(const QStringList& nameFilters) const
.
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The name filter, file attribute filter, and sorting specification can be overridden using the nameFilters, filters, and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryList(), setNameFilters(), setSorting(), setFilter(), isReadable(), and exists().
Sourcepub unsafe fn entry_list_q_flags_filter_q_flags_sort_flag(
&self,
filters: QFlags<Filter>,
sort: QFlags<SortFlag>,
) -> CppBox<QStringList>
pub unsafe fn entry_list_q_flags_filter_q_flags_sort_flag( &self, filters: QFlags<Filter>, sort: QFlags<SortFlag>, ) -> CppBox<QStringList>
This is an overloaded function.
Calls C++ function: QStringList QDir::entryList(QFlags<QDir::Filter> filters = …, QFlags<QDir::SortFlag> sort = …) const
.
This is an overloaded function.
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The attribute filter and sorting specifications can be overridden using the filters and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
Note: To list symlinks that point to non existing files, System must be passed to the filter.
See also entryInfoList(), setNameFilters(), setSorting(), and setFilter().
Sourcepub unsafe fn entry_list_q_string_list_q_flags_filter_q_flags_sort_flag(
&self,
name_filters: impl CastInto<Ref<QStringList>>,
filters: QFlags<Filter>,
sort: QFlags<SortFlag>,
) -> CppBox<QStringList>
pub unsafe fn entry_list_q_string_list_q_flags_filter_q_flags_sort_flag( &self, name_filters: impl CastInto<Ref<QStringList>>, filters: QFlags<Filter>, sort: QFlags<SortFlag>, ) -> CppBox<QStringList>
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
Calls C++ function: QStringList QDir::entryList(const QStringList& nameFilters, QFlags<QDir::Filter> filters = …, QFlags<QDir::SortFlag> sort = …) const
.
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The name filter, file attribute filter, and sorting specification can be overridden using the nameFilters, filters, and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryInfoList(), setNameFilters(), setSorting(), and setFilter().
Sourcepub unsafe fn entry_list_q_flags_filter(
&self,
filters: QFlags<Filter>,
) -> CppBox<QStringList>
pub unsafe fn entry_list_q_flags_filter( &self, filters: QFlags<Filter>, ) -> CppBox<QStringList>
This is an overloaded function.
Calls C++ function: QStringList QDir::entryList(QFlags<QDir::Filter> filters = …) const
.
This is an overloaded function.
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The attribute filter and sorting specifications can be overridden using the filters and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
Note: To list symlinks that point to non existing files, System must be passed to the filter.
See also entryInfoList(), setNameFilters(), setSorting(), and setFilter().
Sourcepub unsafe fn entry_list(&self) -> CppBox<QStringList>
pub unsafe fn entry_list(&self) -> CppBox<QStringList>
This is an overloaded function.
Calls C++ function: QStringList QDir::entryList() const
.
This is an overloaded function.
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The attribute filter and sorting specifications can be overridden using the filters and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
Note: To list symlinks that point to non existing files, System must be passed to the filter.
See also entryInfoList(), setNameFilters(), setSorting(), and setFilter().
Sourcepub unsafe fn entry_list_q_string_list_q_flags_filter(
&self,
name_filters: impl CastInto<Ref<QStringList>>,
filters: QFlags<Filter>,
) -> CppBox<QStringList>
pub unsafe fn entry_list_q_string_list_q_flags_filter( &self, name_filters: impl CastInto<Ref<QStringList>>, filters: QFlags<Filter>, ) -> CppBox<QStringList>
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
Calls C++ function: QStringList QDir::entryList(const QStringList& nameFilters, QFlags<QDir::Filter> filters = …) const
.
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The name filter, file attribute filter, and sorting specification can be overridden using the nameFilters, filters, and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryInfoList(), setNameFilters(), setSorting(), and setFilter().
Sourcepub unsafe fn entry_list_q_string_list(
&self,
name_filters: impl CastInto<Ref<QStringList>>,
) -> CppBox<QStringList>
pub unsafe fn entry_list_q_string_list( &self, name_filters: impl CastInto<Ref<QStringList>>, ) -> CppBox<QStringList>
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
Calls C++ function: QStringList QDir::entryList(const QStringList& nameFilters) const
.
Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
The name filter, file attribute filter, and sorting specification can be overridden using the nameFilters, filters, and sort arguments.
Returns an empty list if the directory is unreadable, does not exist, or if nothing matches the specification.
See also entryInfoList(), setNameFilters(), setSorting(), and setFilter().
Sourcepub unsafe fn exists_0a(&self) -> bool
pub unsafe fn exists_0a(&self) -> bool
This is an overloaded function.
Calls C++ function: bool QDir::exists() const
.
This is an overloaded function.
Returns true
if the directory exists; otherwise returns false
. (If a file with the same name is found this function will return false).
The overload of this function that accepts an argument is used to test for the presence of files and directories within a directory.
See also QFileInfo::exists() and QFile::exists().
Sourcepub unsafe fn exists_1a(&self, name: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn exists_1a(&self, name: impl CastInto<Ref<QString>>) -> bool
Returns true
if the file called name exists; otherwise returns false.
Calls C++ function: bool QDir::exists(const QString& name) const
.
Returns true
if the file called name exists; otherwise returns false.
Unless name contains an absolute file path, the file name is assumed to be relative to the directory itself, so this function is typically used to check for the presence of files within a directory.
See also QFileInfo::exists() and QFile::exists().
Sourcepub unsafe fn file_path(
&self,
file_name: impl CastInto<Ref<QString>>,
) -> CppBox<QString>
pub unsafe fn file_path( &self, file_name: impl CastInto<Ref<QString>>, ) -> CppBox<QString>
Returns the path name of a file in the directory. Does not check if the file actually exists in the directory; but see exists(). If the QDir is relative the returned path name will also be relative. Redundant multiple separators or "." and ".." directories in fileName are not removed (see cleanPath()).
Calls C++ function: QString QDir::filePath(const QString& fileName) const
.
Returns the path name of a file in the directory. Does not check if the file actually exists in the directory; but see exists(). If the QDir is relative the returned path name will also be relative. Redundant multiple separators or “.” and “..” directories in fileName are not removed (see cleanPath()).
See also dirName(), absoluteFilePath(), isRelative(), and canonicalPath().
Sourcepub unsafe fn filter(&self) -> QFlags<Filter>
pub unsafe fn filter(&self) -> QFlags<Filter>
Returns the value set by setFilter()
Calls C++ function: QFlags<QDir::Filter> QDir::filter() const
.
Sourcepub unsafe fn from_native_separators(
path_name: impl CastInto<Ref<QString>>,
) -> CppBox<QString>
pub unsafe fn from_native_separators( path_name: impl CastInto<Ref<QString>>, ) -> CppBox<QString>
Returns pathName using '/' as file separator. On Windows, for instance, fromNativeSeparators("c:\\winnt\\system32
") returns "c:/winnt/system32".
Calls C++ function: static QString QDir::fromNativeSeparators(const QString& pathName)
.
Returns pathName using ‘/’ as file separator. On Windows, for instance, fromNativeSeparators(“c:\winnt\system32
”) returns “c:/winnt/system32”.
The returned string may be the same as the argument on some operating systems, for example on Unix.
This function was introduced in Qt 4.2.
See also toNativeSeparators() and separator().
Sourcepub unsafe fn home() -> CppBox<QDir>
pub unsafe fn home() -> CppBox<QDir>
Returns the user's home directory.
Calls C++ function: static QDir QDir::home()
.
Sourcepub unsafe fn home_path() -> CppBox<QString>
pub unsafe fn home_path() -> CppBox<QString>
Returns the absolute path of the user's home directory.
Calls C++ function: static QString QDir::homePath()
.
Returns the absolute path of the user’s home directory.
Under Windows this function will return the directory of the current user's profile. Typically, this is:
C:/Documents and Settings/Username
Use the toNativeSeparators() function to convert the separators to the ones that are appropriate for the underlying operating system.
If the directory of the current user's profile does not exist or cannot be retrieved, the following alternatives will be checked (in the given order) until an existing and available path is found:
- The path specified by the
USERPROFILE
environment variable. - The path formed by concatenating the
HOMEDRIVE
andHOMEPATH
environment variables. - The path specified by the
HOME
environment variable. - The path returned by the rootPath() function (which uses the
SystemDrive
environment variable) - The
C:/
directory.
Under non-Windows operating systems the HOME
environment variable is used if it exists, otherwise the path returned by the rootPath().
See also home(), currentPath(), rootPath(), and tempPath().
Sourcepub unsafe fn index(&self, arg1: c_int) -> CppBox<QString>
pub unsafe fn index(&self, arg1: c_int) -> CppBox<QString>
Sourcepub unsafe fn is_absolute(&self) -> bool
pub unsafe fn is_absolute(&self) -> bool
Returns true
if the directory's path is absolute; otherwise returns false
. See isAbsolutePath().
Calls C++ function: bool QDir::isAbsolute() const
.
Returns true
if the directory’s path is absolute; otherwise returns false
. See isAbsolutePath().
See also isRelative(), makeAbsolute(), and cleanPath().
Sourcepub unsafe fn is_absolute_path(path: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn is_absolute_path(path: impl CastInto<Ref<QString>>) -> bool
Returns true
if path is absolute; returns false
if it is relative.
Calls C++ function: static bool QDir::isAbsolutePath(const QString& path)
.
Returns true
if path is absolute; returns false
if it is relative.
See also isAbsolute(), isRelativePath(), makeAbsolute(), and cleanPath().
Sourcepub unsafe fn is_empty_1a(&self, filters: QFlags<Filter>) -> bool
pub unsafe fn is_empty_1a(&self, filters: QFlags<Filter>) -> bool
Returns whether the directory is empty.
Calls C++ function: bool QDir::isEmpty(QFlags<QDir::Filter> filters = …) const
.
Returns whether the directory is empty.
Equivalent to count() == 0
with filters QDir::AllEntries | QDir::NoDotAndDotDot
, but faster as it just checks whether the directory contains at least one entry.
Note: Unless you set the filters flags to include QDir::NoDotAndDotDot
(as the default value does), no directory is empty.
This function was introduced in Qt 5.9.
Sourcepub unsafe fn is_empty_0a(&self) -> bool
pub unsafe fn is_empty_0a(&self) -> bool
Returns whether the directory is empty.
Calls C++ function: bool QDir::isEmpty() const
.
Returns whether the directory is empty.
Equivalent to count() == 0
with filters QDir::AllEntries | QDir::NoDotAndDotDot
, but faster as it just checks whether the directory contains at least one entry.
Note: Unless you set the filters flags to include QDir::NoDotAndDotDot
(as the default value does), no directory is empty.
This function was introduced in Qt 5.9.
Sourcepub unsafe fn is_readable(&self) -> bool
pub unsafe fn is_readable(&self) -> bool
Returns true
if the directory is readable and we can open files by name; otherwise returns false
.
Calls C++ function: bool QDir::isReadable() const
.
Returns true
if the directory is readable and we can open files by name; otherwise returns false
.
Warning: A false value from this function is not a guarantee that files in the directory are not accessible.
See also QFileInfo::isReadable().
Sourcepub unsafe fn is_relative(&self) -> bool
pub unsafe fn is_relative(&self) -> bool
Returns true
if the directory path is relative; otherwise returns false. (Under Unix a path is relative if it does not start with a "/").
Calls C++ function: bool QDir::isRelative() const
.
Returns true
if the directory path is relative; otherwise returns false. (Under Unix a path is relative if it does not start with a “/”).
See also makeAbsolute(), isAbsolute(), isAbsolutePath(), and cleanPath().
Sourcepub unsafe fn is_relative_path(path: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn is_relative_path(path: impl CastInto<Ref<QString>>) -> bool
Returns true
if path is relative; returns false
if it is absolute.
Calls C++ function: static bool QDir::isRelativePath(const QString& path)
.
Returns true
if path is relative; returns false
if it is absolute.
See also isRelative(), isAbsolutePath(), and makeAbsolute().
Sourcepub unsafe fn is_root(&self) -> bool
pub unsafe fn is_root(&self) -> bool
Returns true
if the directory is the root directory; otherwise returns false
.
Calls C++ function: bool QDir::isRoot() const
.
Returns true
if the directory is the root directory; otherwise returns false
.
Note: If the directory is a symbolic link to the root directory this function returns false
. If you want to test for this use canonicalPath(), e.g.
QDir dir(“/tmp/root_link”); dir = dir.canonicalPath(); if (dir.isRoot()) qWarning(“It is a root link”);
Sourcepub unsafe fn list_separator() -> CppBox<QChar>
pub unsafe fn list_separator() -> CppBox<QChar>
Returns the native path list separator: ':' under Unix and ';' under Windows.
Calls C++ function: static QChar QDir::listSeparator()
.
Returns the native path list separator: ‘:’ under Unix and ‘;’ under Windows.
This function was introduced in Qt 5.6.
See also separator().
Sourcepub unsafe fn make_absolute(&self) -> bool
pub unsafe fn make_absolute(&self) -> bool
Converts the directory path to an absolute path. If it is already absolute nothing happens. Returns true
if the conversion succeeded; otherwise returns false
.
Calls C++ function: bool QDir::makeAbsolute()
.
Converts the directory path to an absolute path. If it is already absolute nothing happens. Returns true
if the conversion succeeded; otherwise returns false
.
See also isAbsolute(), isAbsolutePath(), isRelative(), and cleanPath().
Sourcepub unsafe fn match_q_string_list_q_string(
filters: impl CastInto<Ref<QStringList>>,
file_name: impl CastInto<Ref<QString>>,
) -> bool
pub unsafe fn match_q_string_list_q_string( filters: impl CastInto<Ref<QStringList>>, file_name: impl CastInto<Ref<QString>>, ) -> bool
This is an overloaded function.
Calls C++ function: static bool QDir::match(const QStringList& filters, const QString& fileName)
.
This is an overloaded function.
Returns true
if the fileName matches any of the wildcard (glob) patterns in the list of filters; otherwise returns false
. The matching is case insensitive.
See also QRegExp wildcard matching, QRegExp::exactMatch(), entryList(), and entryInfoList().
Sourcepub unsafe fn match_2_q_string(
filter: impl CastInto<Ref<QString>>,
file_name: impl CastInto<Ref<QString>>,
) -> bool
pub unsafe fn match_2_q_string( filter: impl CastInto<Ref<QString>>, file_name: impl CastInto<Ref<QString>>, ) -> bool
Returns true
if the fileName matches the wildcard (glob) pattern filter; otherwise returns false
. The filter may contain multiple patterns separated by spaces or semicolons. The matching is case insensitive.
Calls C++ function: static bool QDir::match(const QString& filter, const QString& fileName)
.
Returns true
if the fileName matches the wildcard (glob) pattern filter; otherwise returns false
. The filter may contain multiple patterns separated by spaces or semicolons. The matching is case insensitive.
See also QRegExp wildcard matching, QRegExp::exactMatch(), entryList(), and entryInfoList().
Sourcepub unsafe fn mkdir(&self, dir_name: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn mkdir(&self, dir_name: impl CastInto<Ref<QString>>) -> bool
Creates a sub-directory called dirName.
Calls C++ function: bool QDir::mkdir(const QString& dirName) const
.
Creates a sub-directory called dirName.
Returns true
on success; otherwise returns false
.
If the directory already exists when this function is called, it will return false.
See also rmdir().
Sourcepub unsafe fn mkpath(&self, dir_path: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn mkpath(&self, dir_path: impl CastInto<Ref<QString>>) -> bool
Creates the directory path dirPath.
Calls C++ function: bool QDir::mkpath(const QString& dirPath) const
.
Creates the directory path dirPath.
The function will create all parent directories necessary to create the directory.
Returns true
if successful; otherwise returns false
.
If the path already exists when this function is called, it will return true.
See also rmpath().
Sourcepub unsafe fn name_filters(&self) -> CppBox<QStringList>
pub unsafe fn name_filters(&self) -> CppBox<QStringList>
Returns the string list set by setNameFilters()
Calls C++ function: QStringList QDir::nameFilters() const
.
Returns the string list set by setNameFilters()
See also setNameFilters().
Sourcepub unsafe fn name_filters_from_string(
name_filter: impl CastInto<Ref<QString>>,
) -> CppBox<QStringList>
pub unsafe fn name_filters_from_string( name_filter: impl CastInto<Ref<QString>>, ) -> CppBox<QStringList>
Calls C++ function: static QStringList QDir::nameFiltersFromString(const QString& nameFilter)
.
Sourcepub unsafe fn new_1a(path: impl CastInto<Ref<QString>>) -> CppBox<QDir>
pub unsafe fn new_1a(path: impl CastInto<Ref<QString>>) -> CppBox<QDir>
Constructs a QDir pointing to the given directory path. If path is empty the program's working directory, ("."), is used.
Calls C++ function: [constructor] void QDir::QDir(const QString& path = …)
.
Constructs a QDir pointing to the given directory path. If path is empty the program’s working directory, (“.”), is used.
See also currentPath().
Sourcepub unsafe fn new_4a(
path: impl CastInto<Ref<QString>>,
name_filter: impl CastInto<Ref<QString>>,
sort: QFlags<SortFlag>,
filter: QFlags<Filter>,
) -> CppBox<QDir>
pub unsafe fn new_4a( path: impl CastInto<Ref<QString>>, name_filter: impl CastInto<Ref<QString>>, sort: QFlags<SortFlag>, filter: QFlags<Filter>, ) -> CppBox<QDir>
Constructs a QDir with path path, that filters its entries by name using nameFilter and by attributes using filters. It also sorts the names using sort.
Calls C++ function: [constructor] void QDir::QDir(const QString& path, const QString& nameFilter, QFlags<QDir::SortFlag> sort = …, QFlags<QDir::Filter> filter = …)
.
Constructs a QDir with path path, that filters its entries by name using nameFilter and by attributes using filters. It also sorts the names using sort.
The default nameFilter is an empty string, which excludes nothing; the default filters is AllEntries, which also means exclude nothing. The default sort is Name | IgnoreCase, i.e. sort by name case-insensitively.
If path is an empty string, QDir uses "." (the current directory). If nameFilter is an empty string, QDir uses the name filter "*" (all files).
Note that path need not exist.
See also exists(), setPath(), setNameFilters(), setFilter(), and setSorting().
Sourcepub unsafe fn new_0a() -> CppBox<QDir>
pub unsafe fn new_0a() -> CppBox<QDir>
The QDir class provides access to directory structures and their contents.
Calls C++ function: [constructor] void QDir::QDir()
.
The QDir class provides access to directory structures and their contents.
A QDir is used to manipulate path names, access information regarding paths and files, and manipulate the underlying file system. It can also be used to access Qt's resource system.
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.
A QDir can point to a file using either a relative or an absolute path. Absolute paths begin with the directory separator (optionally preceded by a drive specification under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory.
Examples of absolute paths:
QDir(“/home/user/Documents”) QDir(“C:/Documents and Settings”)
On Windows, the second example above will be translated to C:\Documents and Settings
when used to access files.
Examples of relative paths:
QDir(“images/landscape.png”)
You can use the isRelative() or isAbsolute() functions to check if a QDir is using a relative or an absolute file path. Call makeAbsolute() to convert a relative QDir to an absolute one.
Sourcepub unsafe fn new_3a(
path: impl CastInto<Ref<QString>>,
name_filter: impl CastInto<Ref<QString>>,
sort: QFlags<SortFlag>,
) -> CppBox<QDir>
pub unsafe fn new_3a( path: impl CastInto<Ref<QString>>, name_filter: impl CastInto<Ref<QString>>, sort: QFlags<SortFlag>, ) -> CppBox<QDir>
Constructs a QDir with path path, that filters its entries by name using nameFilter and by attributes using filters. It also sorts the names using sort.
Calls C++ function: [constructor] void QDir::QDir(const QString& path, const QString& nameFilter, QFlags<QDir::SortFlag> sort = …)
.
Constructs a QDir with path path, that filters its entries by name using nameFilter and by attributes using filters. It also sorts the names using sort.
The default nameFilter is an empty string, which excludes nothing; the default filters is AllEntries, which also means exclude nothing. The default sort is Name | IgnoreCase, i.e. sort by name case-insensitively.
If path is an empty string, QDir uses "." (the current directory). If nameFilter is an empty string, QDir uses the name filter "*" (all files).
Note that path need not exist.
See also exists(), setPath(), setNameFilters(), setFilter(), and setSorting().
Sourcepub unsafe fn new_2a(
path: impl CastInto<Ref<QString>>,
name_filter: impl CastInto<Ref<QString>>,
) -> CppBox<QDir>
pub unsafe fn new_2a( path: impl CastInto<Ref<QString>>, name_filter: impl CastInto<Ref<QString>>, ) -> CppBox<QDir>
Constructs a QDir with path path, that filters its entries by name using nameFilter and by attributes using filters. It also sorts the names using sort.
Calls C++ function: [constructor] void QDir::QDir(const QString& path, const QString& nameFilter)
.
Constructs a QDir with path path, that filters its entries by name using nameFilter and by attributes using filters. It also sorts the names using sort.
The default nameFilter is an empty string, which excludes nothing; the default filters is AllEntries, which also means exclude nothing. The default sort is Name | IgnoreCase, i.e. sort by name case-insensitively.
If path is an empty string, QDir uses "." (the current directory). If nameFilter is an empty string, QDir uses the name filter "*" (all files).
Note that path need not exist.
See also exists(), setPath(), setNameFilters(), setFilter(), and setSorting().
Sourcepub unsafe fn path(&self) -> CppBox<QString>
pub unsafe fn path(&self) -> CppBox<QString>
Returns the path. This may contain symbolic links, but never contains redundant ".", ".." or multiple separators.
Calls C++ function: QString QDir::path() const
.
Returns the path. This may contain symbolic links, but never contains redundant “.”, “..” or multiple separators.
The returned path can be either absolute or relative (see setPath()).
See also setPath(), absolutePath(), exists(), cleanPath(), dirName(), absoluteFilePath(), toNativeSeparators(), and makeAbsolute().
Sourcepub unsafe fn refresh(&self)
pub unsafe fn refresh(&self)
Refreshes the directory information.
Calls C++ function: void QDir::refresh() const
.
Refreshes the directory information.
Sourcepub unsafe fn relative_file_path(
&self,
file_name: impl CastInto<Ref<QString>>,
) -> CppBox<QString>
pub unsafe fn relative_file_path( &self, file_name: impl CastInto<Ref<QString>>, ) -> CppBox<QString>
Returns the path to fileName relative to the directory.
Calls C++ function: QString QDir::relativeFilePath(const QString& fileName) const
.
Returns the path to fileName relative to the directory.
QDir dir("/home/bob"); QString s; s = dir.relativeFilePath("images/file.jpg"); // s is "images/file.jpg" s = dir.relativeFilePath("/home/mary/file.txt"); // s is "../mary/file.txt"
See also absoluteFilePath(), filePath(), and canonicalPath().
Sourcepub unsafe fn remove(&self, file_name: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn remove(&self, file_name: impl CastInto<Ref<QString>>) -> bool
Removes the file, fileName.
Calls C++ function: bool QDir::remove(const QString& fileName)
.
Removes the file, fileName.
Returns true
if the file is removed successfully; otherwise returns false
.
Sourcepub unsafe fn remove_recursively(&self) -> bool
pub unsafe fn remove_recursively(&self) -> bool
Removes the directory, including all its contents.
Calls C++ function: bool QDir::removeRecursively()
.
Removes the directory, including all its contents.
Returns true
if successful, otherwise false.
If a file or directory cannot be removed, removeRecursively() keeps going and attempts to delete as many files and sub-directories as possible, then returns false
.
If the directory was already removed, the method returns true
(expected result already reached).
Note: this function is meant for removing a small application-internal directory (such as a temporary directory), but not user-visible directories. For user-visible operations, it is rather recommended to report errors more precisely to the user, to offer solutions in case of errors, to show progress during the deletion since it could take several minutes, etc.
This function was introduced in Qt 5.0.
Sourcepub unsafe fn rename(
&self,
old_name: impl CastInto<Ref<QString>>,
new_name: impl CastInto<Ref<QString>>,
) -> bool
pub unsafe fn rename( &self, old_name: impl CastInto<Ref<QString>>, new_name: impl CastInto<Ref<QString>>, ) -> bool
Renames a file or directory from oldName to newName, and returns true if successful; otherwise returns false
.
Calls C++ function: bool QDir::rename(const QString& oldName, const QString& newName)
.
Renames a file or directory from oldName to newName, and returns true if successful; otherwise returns false
.
On most file systems, rename() fails only if oldName does not exist, or if a file with the new name already exists. However, there are also other reasons why rename() can fail. For example, on at least one file system rename() fails if newName points to an open file.
If oldName is a file (not a directory) that can't be renamed right away, Qt will try to copy oldName to newName and remove oldName.
See also QFile::rename().
Sourcepub unsafe fn rmdir(&self, dir_name: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn rmdir(&self, dir_name: impl CastInto<Ref<QString>>) -> bool
Removes the directory specified by dirName.
Calls C++ function: bool QDir::rmdir(const QString& dirName) const
.
Removes the directory specified by dirName.
The directory must be empty for rmdir() to succeed.
Returns true
if successful; otherwise returns false
.
See also mkdir().
Sourcepub unsafe fn rmpath(&self, dir_path: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn rmpath(&self, dir_path: impl CastInto<Ref<QString>>) -> bool
Removes the directory path dirPath.
Calls C++ function: bool QDir::rmpath(const QString& dirPath) const
.
Removes the directory path dirPath.
The function will remove all parent directories in dirPath, provided that they are empty. This is the opposite of mkpath(dirPath).
Returns true
if successful; otherwise returns false
.
See also mkpath().
Sourcepub unsafe fn root() -> CppBox<QDir>
pub unsafe fn root() -> CppBox<QDir>
Returns the root directory.
Calls C++ function: static QDir QDir::root()
.
Sourcepub unsafe fn root_path() -> CppBox<QString>
pub unsafe fn root_path() -> CppBox<QString>
Returns the absolute path of the root directory.
Calls C++ function: static QString QDir::rootPath()
.
Returns the absolute path of the root directory.
For Unix operating systems this returns "/". For Windows file systems this normally returns "c:/".
See also root(), drives(), currentPath(), homePath(), and tempPath().
Sourcepub unsafe fn search_paths(
prefix: impl CastInto<Ref<QString>>,
) -> CppBox<QStringList>
pub unsafe fn search_paths( prefix: impl CastInto<Ref<QString>>, ) -> CppBox<QStringList>
Returns the search paths for prefix.
Calls C++ function: static QStringList QDir::searchPaths(const QString& prefix)
.
Returns the search paths for prefix.
This function was introduced in Qt 4.3.
See also setSearchPaths() and addSearchPath().
Sourcepub unsafe fn separator() -> CppBox<QChar>
pub unsafe fn separator() -> CppBox<QChar>
Returns the native directory separator: "/" under Unix and "\" under Windows.
Calls C++ function: static QChar QDir::separator()
.
Returns the native directory separator: “/” under Unix and “" under Windows.
You do not need to use this function to build file paths. If you always use "/", Qt will translate your paths to conform to the underlying operating system. If you want to display paths to the user using their operating system's separator use toNativeSeparators().
See also listSeparator().
Sourcepub unsafe fn set_current(path: impl CastInto<Ref<QString>>) -> bool
pub unsafe fn set_current(path: impl CastInto<Ref<QString>>) -> bool
Sets the application's current working directory to path. Returns true
if the directory was successfully changed; otherwise returns false
.
Calls C++ function: static bool QDir::setCurrent(const QString& path)
.
Sets the application’s current working directory to path. Returns true
if the directory was successfully changed; otherwise returns false
.
See also current(), currentPath(), home(), root(), and temp().
Sourcepub unsafe fn set_filter(&self, filter: QFlags<Filter>)
pub unsafe fn set_filter(&self, filter: QFlags<Filter>)
Sets the filter used by entryList() and entryInfoList() to filters. The filter is used to specify the kind of files that should be returned by entryList() and entryInfoList(). See QDir::Filter.
Calls C++ function: void QDir::setFilter(QFlags<QDir::Filter> filter)
.
Sets the filter used by entryList() and entryInfoList() to filters. The filter is used to specify the kind of files that should be returned by entryList() and entryInfoList(). See QDir::Filter.
See also filter() and setNameFilters().
Sourcepub unsafe fn set_name_filters(
&self,
name_filters: impl CastInto<Ref<QStringList>>,
)
pub unsafe fn set_name_filters( &self, name_filters: impl CastInto<Ref<QStringList>>, )
Sets the name filters used by entryList() and entryInfoList() to the list of filters specified by nameFilters.
Calls C++ function: void QDir::setNameFilters(const QStringList& nameFilters)
.
Sets the name filters used by entryList() and entryInfoList() to the list of filters specified by nameFilters.
Each name filter is a wildcard (globbing) filter that understands *
and ?
wildcards. (See QRegExp wildcard matching.)
For example, the following code sets three name filters on a QDir to ensure that only files with extensions typically used for C++ source files are listed:
QStringList filters; filters << “.cpp” << “.cxx” << “*.cc”; dir.setNameFilters(filters);
See also nameFilters() and setFilter().
Sourcepub unsafe fn set_path(&self, path: impl CastInto<Ref<QString>>)
pub unsafe fn set_path(&self, path: impl CastInto<Ref<QString>>)
Sets the path of the directory to path. The path is cleaned of redundant ".", ".." and of multiple separators. No check is made to see whether a directory with this path actually exists; but you can check for yourself using exists().
Calls C++ function: void QDir::setPath(const QString& path)
.
Sets the path of the directory to path. The path is cleaned of redundant “.”, “..” and of multiple separators. No check is made to see whether a directory with this path actually exists; but you can check for yourself using exists().
The path can be either absolute or relative. Absolute paths begin with the directory separator "/" (optionally preceded by a drive specification under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory. An example of an absolute path is the string "/tmp/quartz", a relative path might look like "src/fatlib".
See also path(), absolutePath(), exists(), cleanPath(), dirName(), absoluteFilePath(), isRelative(), and makeAbsolute().
Sourcepub unsafe fn set_search_paths(
prefix: impl CastInto<Ref<QString>>,
search_paths: impl CastInto<Ref<QStringList>>,
)
pub unsafe fn set_search_paths( prefix: impl CastInto<Ref<QString>>, search_paths: impl CastInto<Ref<QStringList>>, )
Sets or replaces Qt's search paths for file names with the prefix prefix to searchPaths.
Calls C++ function: static void QDir::setSearchPaths(const QString& prefix, const QStringList& searchPaths)
.
Sets or replaces Qt’s search paths for file names with the prefix prefix to searchPaths.
To specify a prefix for a file name, prepend the prefix followed by a single colon (e.g., "images:undo.png", "xmldocs:books.xml"). prefix can only contain letters or numbers (e.g., it cannot contain a colon, nor a slash).
Qt uses this search path to locate files with a known prefix. The search path entries are tested in order, starting with the first entry.
QDir::setSearchPaths(“icons”, QStringList(QDir::homePath() + “/images”)); QDir::setSearchPaths(“docs”, QStringList(“:/embeddedDocuments”)); ... QPixmap pixmap(“icons:undo.png”); // will look for undo.png in QDir::homePath() + “/images” QFile file(“docs:design.odf”); // will look in the :/embeddedDocuments resource path
File name prefix must be at least 2 characters long to avoid conflicts with Windows drive letters.
Search paths may contain paths to The Qt Resource System.
This function was introduced in Qt 4.3.
See also searchPaths().
Sourcepub unsafe fn set_sorting(&self, sort: QFlags<SortFlag>)
pub unsafe fn set_sorting(&self, sort: QFlags<SortFlag>)
Sets the sort order used by entryList() and entryInfoList().
Calls C++ function: void QDir::setSorting(QFlags<QDir::SortFlag> sort)
.
Sets the sort order used by entryList() and entryInfoList().
The sort is specified by OR-ing values from the enum QDir::SortFlag.
Sourcepub unsafe fn sorting(&self) -> QFlags<SortFlag>
pub unsafe fn sorting(&self) -> QFlags<SortFlag>
Returns the value set by setSorting()
Calls C++ function: QFlags<QDir::SortFlag> QDir::sorting() const
.
Returns the value set by setSorting()
See also setSorting() and SortFlag.
Sourcepub unsafe fn swap(&self, other: impl CastInto<Ref<QDir>>)
pub unsafe fn swap(&self, other: impl CastInto<Ref<QDir>>)
Sourcepub unsafe fn temp() -> CppBox<QDir>
pub unsafe fn temp() -> CppBox<QDir>
Returns the system's temporary directory.
Calls C++ function: static QDir QDir::temp()
.
Sourcepub unsafe fn temp_path() -> CppBox<QString>
pub unsafe fn temp_path() -> CppBox<QString>
Returns the absolute path of the system's temporary directory.
Calls C++ function: static QString QDir::tempPath()
.
Returns the absolute path of the system’s temporary directory.
On Unix/Linux systems this is the path in the TMPDIR
environment variable or /tmp
if TMPDIR
is not defined. On Windows this is usually the path in the TEMP
or TMP
environment variable. The path returned by this method doesn't end with a directory separator unless it is the root directory (of a drive).
See also temp(), currentPath(), homePath(), and rootPath().
Sourcepub unsafe fn to_native_separators(
path_name: impl CastInto<Ref<QString>>,
) -> CppBox<QString>
pub unsafe fn to_native_separators( path_name: impl CastInto<Ref<QString>>, ) -> CppBox<QString>
Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
Calls C++ function: static QString QDir::toNativeSeparators(const QString& pathName)
.
Returns pathName with the ‘/’ separators converted to separators that are appropriate for the underlying operating system.
On Windows, toNativeSeparators("c:/winnt/system32") returns "c:\winnt\system32".
The returned string may be the same as the argument on some operating systems, for example on Unix.
This function was introduced in Qt 4.2.
See also fromNativeSeparators() and separator().