Skip to content

PythonQt.QtCore.QDir · declarations 003

Back to PythonQt.QtCore.QDir

searchPaths

searchPaths(prefix: str) -> tuple

X.searchPaths(prefix) -> tuple

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

searchPaths(prefix: str) -> typing.List[str]

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#searchPaths

separator

separator() -> str

X.separator()

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

separator() -> str

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#separator

setCurrent

setCurrent(path: str) -> bool

X.setCurrent(path) -> bool

Supplemental documentation: Qt 5 reference:

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

QString absolute = "/local/bin";
QString relative = "local/bin";
QFileInfo absFile(absolute);
QFileInfo relFile(relative);

QDir::setCurrent(QDir::rootPath());
// absFile and relFile now point to the same file

QDir::setCurrent("/tmp");
// absFile now points to "/local/bin",
// while relFile points to "/temporary/local/bin"

See also current(), currentPath(), home(), root(), and temp().

Upstream PySide2 reference signatures (binding differences may apply):

setCurrent(path: str) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#setCurrent

setFilter

setFilter(filter: Any) -> None

X.setFilter(filter)

Supplemental documentation: Qt 5 reference:

void QDir::setFilter(QDir::Filters filters)

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

Upstream PySide2 reference signatures (binding differences may apply):

setFilter(self, filter: PySide2.QtCore.QDir.Filters) -> None

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#setFilter

setNameFilters

setNameFilters(nameFilters: Any) -> None

X.setNameFilters(nameFilters)

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

setNameFilters(self, nameFilters: typing.Sequence[str]) -> None

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#setNameFilters

setPath

setPath(path: str) -> None

X.setPath(path)

Supplemental documentation: Qt 5 reference:

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 "/temporary/quartz", a relative path might look like "src/fatlib".

See also path(), absolutePath(), exists(), cleanPath(), dirName(), absoluteFilePath(), isRelative(), and makeAbsolute().

Upstream PySide2 reference signatures (binding differences may apply):

setPath(self, path: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#setPath

setSearchPaths

setSearchPaths(prefix: str, searchPaths: Any) -> None

X.setSearchPaths(prefix, searchPaths)

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

setSearchPaths(prefix: str, searchPaths: typing.Sequence[str]) -> None

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#setSearchPaths

setSorting

setSorting(sort: Any) -> None

X.setSorting(sort)

Supplemental documentation: Qt 5 reference:

void QDir::setSorting(QDir::SortFlags sort)

Sets the sort order used by entryList() and entryInfoList().

The sort is specified by OR-ing values from the enum QDir::SortFlag.

See also sorting() and SortFlag.

Upstream PySide2 reference signatures (binding differences may apply):

setSorting(self, sort: PySide2.QtCore.QDir.SortFlags) -> None

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#setSorting

sorting

sorting() -> Any

X.sorting()

Supplemental documentation: Qt 5 reference:

QDir::SortFlags QDir::sorting() const

Returns the value set by setSorting()

See also setSorting() and SortFlag.

Upstream PySide2 reference signatures (binding differences may apply):

sorting(self) -> PySide2.QtCore.QDir.SortFlags

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#sorting

swap

swap(other: Any) -> None

X.swap(other)

Supplemental documentation: Qt 5 reference:

void QDir::swap(QDir \&other)

Swaps this QDir instance with other. This function is very fast and never fails.

This function was introduced in Qt 5.0.

Upstream PySide2 reference signatures (binding differences may apply):

swap(self, other: PySide2.QtCore.QDir) -> None

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#swap

temp

temp() -> Any

X.temp() -> PythonQt.QtCore.QDir

Supplemental documentation: Qt 5 reference:

[static] QDir QDir::temp()

Returns the system's temporary directory.

The directory is constructed using the absolute canonical path of the temporary directory, ensuring that its path() will be the same as its absolutePath().

See tempPath() for details.

See also drives(), current(), home(), and root().

Upstream PySide2 reference signatures (binding differences may apply):

temp() -> PySide2.QtCore.QDir

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#temp

tempPath

tempPath() -> str

X.tempPath() -> str

Supplemental documentation: Qt 5 reference:

[static] QString QDir::tempPath()

Returns the absolute canonical 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().

Upstream PySide2 reference signatures (binding differences may apply):

tempPath() -> str

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#tempPath

toNativeSeparators

toNativeSeparators(pathName: str) -> str

X.toNativeSeparators(pathName) -> str

Supplemental documentation: Qt 5 reference:

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

Upstream PySide2 reference signatures (binding differences may apply):

toNativeSeparators(pathName: str) -> str

Source: https://doc.qt.io/archives/qt-5.15/qdir.html#toNativeSeparators