Skip to content

PythonQt.QtCore.QUrl · declarations 001

Back to PythonQt.QtCore.QUrl

AssumeLocalFile instance-attribute

AssumeLocalFile: Any

ComponentFormattingOption instance-attribute

ComponentFormattingOption: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

ComponentFormattingOptions instance-attribute

ComponentFormattingOptions: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

DecodeReserved instance-attribute

DecodeReserved: Any

DecodedMode instance-attribute

DecodedMode: Any

DefaultResolution instance-attribute

DefaultResolution: Any

EncodeDelimiters instance-attribute

EncodeDelimiters: Any

EncodeReserved instance-attribute

EncodeReserved: Any

EncodeSpaces instance-attribute

EncodeSpaces: Any

EncodeUnicode instance-attribute

EncodeUnicode: Any

FullyDecoded instance-attribute

FullyDecoded: Any

FullyEncoded instance-attribute

FullyEncoded: Any

NormalizePathSegments instance-attribute

NormalizePathSegments: Any

ParsingMode instance-attribute

ParsingMode: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

PreferLocalFile instance-attribute

PreferLocalFile: Any

PrettyDecoded instance-attribute

PrettyDecoded: Any

RemoveAuthority instance-attribute

RemoveAuthority: Any

RemoveFilename instance-attribute

RemoveFilename: Any

RemoveFragment instance-attribute

RemoveFragment: Any

RemovePassword instance-attribute

RemovePassword: Any

RemovePath instance-attribute

RemovePath: Any

RemovePort instance-attribute

RemovePort: Any

RemoveQuery instance-attribute

RemoveQuery: Any

RemoveScheme instance-attribute

RemoveScheme: Any

RemoveUserInfo instance-attribute

RemoveUserInfo: Any

StrictMode instance-attribute

StrictMode: Any

StripTrailingSlash instance-attribute

StripTrailingSlash: Any

TolerantMode instance-attribute

TolerantMode: Any

UrlFormattingOption instance-attribute

UrlFormattingOption: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

UserInputResolutionOption instance-attribute

UserInputResolutionOption: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

adjusted

adjusted(options: Any) -> Any

X.adjusted(options) -> PythonQt.QtCore.QUrl

Supplemental documentation: Qt 5 reference:

QUrl QUrl::adjusted(QUrl::FormattingOptions options) const

Returns an adjusted version of the URL. The output can be customized by passing flags with options.

The encoding options from QUrl::ComponentFormattingOption don't make much sense for this method, nor does QUrl::PreferLocalFile.

This is always equivalent to QUrl(url.toString(options)).

This function was introduced in Qt 5.2.

See also FormattingOptions, toEncoded(), and toString().

Upstream PySide2 reference signatures (binding differences may apply):

adjusted(self, options: PySide2.QtCore.QUrl.FormattingOptions) -> PySide2.QtCore.QUrl

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#adjusted

authority

authority(options: Any) -> str

X.authority(options) -> str

Supplemental documentation: Qt 5 reference:

QString QUrl::authority(QUrl::ComponentFormattingOptions options \= PrettyDecoded) const

Returns the authority of the URL if it is defined; otherwise an empty string is returned.

This function returns an unambiguous value, which may contain that characters still percent-encoded, plus some control sequences not representable in decoded form in QString.

The options argument controls how to format the user info component. The value of QUrl::FullyDecoded is not permitted in this function. If you need to obtain fully decoded data, call userName(), password(), host() and port() individually.

See also setAuthority(), userInfo(), userName(), password(), host(), and port().

Upstream PySide2 reference signatures (binding differences may apply):

authority(self, options: PySide2.QtCore.QUrl.ComponentFormattingOption=...) -> str

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#authority

clear

clear() -> None

X.clear()

Supplemental documentation: Qt 5 reference:

void QUrl::clear()

Resets the content of the QUrl. After calling this function, the QUrl is equal to one that has been constructed with the default empty constructor.

See also isEmpty().

Upstream PySide2 reference signatures (binding differences may apply):

clear(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#clear

errorString

errorString() -> str

X.errorString() -> str

Supplemental documentation: Qt 5 reference:

QString QUrl::errorString() const

Returns an error message if the last operation that modified this QUrl object ran into a parsing error. If no error was detected, this function returns an empty string and isValid() returns true.

The error message returned by this function is technical in nature and may not be understood by end users. It is mostly useful to developers trying to understand why QUrl will not accept some input.

This function was introduced in Qt 4.2.

See also QUrl::ParsingMode.

Upstream PySide2 reference signatures (binding differences may apply):

errorString(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#errorString

fileName

fileName(options: Any) -> str

X.fileName(options) -> str

Supplemental documentation: Qt 5 reference:

QString QUrl::fileName(QUrl::ComponentFormattingOptions options \= FullyDecoded) const

Returns the name of the file, excluding the directory path.

Note that, if this QUrl object is given a path ending in a slash, the name of the file is considered empty.

If the path doesn't contain any slash, it is fully returned as the fileName.

Example:

QUrl url("http://qt-project.org/support/file.html");
// url.adjusted(RemoveFilename) == "http://qt-project.org/support/"
// url.fileName() == "file.html"

The options argument controls how to format the file name component. All values produce an unambiguous result. With QUrl::FullyDecoded, all percent-encoded sequences are decoded; otherwise, the returned value may contain some percent-encoded sequences for some control sequences not representable in decoded form in QString.

This function was introduced in Qt 5.2.

See also path().

Upstream PySide2 reference signatures (binding differences may apply):

fileName(self, options: PySide2.QtCore.QUrl.ComponentFormattingOption=...) -> str

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#fileName

fragment

fragment(options: Any) -> str

X.fragment(options) -> str

Supplemental documentation: Qt 5 reference:

QString QUrl::fragment(QUrl::ComponentFormattingOptions options \= PrettyDecoded) const

Returns the fragment of the URL. To determine if the parsed URL contained a fragment, use hasFragment().

The options argument controls how to format the fragment component. All values produce an unambiguous result. With QUrl::FullyDecoded, all percent-encoded sequences are decoded; otherwise, the returned value may contain some percent-encoded sequences for some control sequences not representable in decoded form in QString.

Note that QUrl::FullyDecoded may cause data loss if those non-representable sequences are present. It is recommended to use that value when the result will be used in a non-URL context.

See also setFragment() and hasFragment().

Upstream PySide2 reference signatures (binding differences may apply):

fragment(self, options: PySide2.QtCore.QUrl.ComponentFormattingOption=...) -> str

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#fragment

fromAce

fromAce(arg__1: Any) -> str

X.fromAce(arg__1) -> str

Supplemental documentation: Qt 5 reference:

[static] QString QUrl::fromAce(const QByteArray \&domain)

Returns the Unicode form of the given domain name domain, which is encoded in the ASCII Compatible Encoding (ACE). The result of this function is considered equivalent to domain.

If the value in domain cannot be encoded, it will be converted to QString and returned.

The ASCII Compatible Encoding (ACE) is defined by RFC 3490, RFC 3491 and RFC 3492. It is part of the Internationalizing Domain Names in Applications (IDNA) specification, which allows for domain names (like "example.com") to be written using international characters.

This function was introduced in Qt 4.2.

Upstream PySide2 reference signatures (binding differences may apply):

fromAce(arg__1: PySide2.QtCore.QByteArray) -> str

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#fromAce

fromEncoded

fromEncoded(url: Any, mode: Any) -> Any

X.fromEncoded(url, mode) -> PythonQt.QtCore.QUrl

Supplemental documentation: Qt 5 reference:

[static] QUrl QUrl::fromEncoded(const QByteArray \&input, QUrl::ParsingMode parsingMode \= TolerantMode)

Parses input and returns the corresponding QUrl. input is assumed to be in encoded form, containing only ASCII characters.

Parses the URL using parsingMode. See setUrl() for more information on this parameter. QUrl::DecodedMode is not permitted in this context.

See also toEncoded() and setUrl().

Upstream PySide2 reference signatures (binding differences may apply):

fromEncoded(url: PySide2.QtCore.QByteArray, mode: PySide2.QtCore.QUrl.ParsingMode=...) -> PySide2.QtCore.QUrl

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#fromEncoded

fromLocalFile

fromLocalFile(localfile: str) -> Any

X.fromLocalFile(localfile) -> PythonQt.QtCore.QUrl

Supplemental documentation: Qt 5 reference:

[static] QUrl QUrl::fromLocalFile(const QString \&localFile)

Returns a QUrl representation of localFile, interpreted as a local file. This function accepts paths separated by slashes as well as the native separator for this platform.

This function also accepts paths with a doubled leading slash (or backslash) to indicate a remote file, as in "//servername/path/to/file.txt". Note that only certain platforms can actually open this file using QFile::open().

An empty localFile leads to an empty URL (since Qt 5.4).

    qDebug() << QUrl::fromLocalFile("file.txt");            // QUrl("file:file.txt")
    qDebug() << QUrl::fromLocalFile("/home/user/file.txt"); // QUrl("file:///home/user/file.txt")
    qDebug() << QUrl::fromLocalFile("file:file.txt");       // doesn't make sense; expects path, not url with scheme

In the first line in snippet above, a file URL is constructed from a local, relative path. A file URL with a relative path only makes sense if there is a base URL to resolve it against. For example:

    QUrl url = QUrl::fromLocalFile("file.txt");
    QUrl baseUrl = QUrl("file:/home/user/");
    // wrong: prints QUrl("file:file.txt"), as url already has a scheme
    qDebug() << baseUrl.resolved(url);

To resolve such a URL, it's necessary to remove the scheme beforehand:

    // correct: prints QUrl("file:///home/user/file.txt")
    url.setScheme(QString());
    qDebug() << baseUrl.resolved(url);

For this reason, it is better to use a relative URL (that is, no scheme) for relative file paths:

    QUrl url = QUrl("file.txt");
    QUrl baseUrl = QUrl("file:/home/user/");
    // prints QUrl("file:///home/user/file.txt")
    qDebug() << baseUrl.resolved(url);

See also toLocalFile(), isLocalFile(), and QDir::toNativeSeparators().

Upstream PySide2 reference signatures (binding differences may apply):

fromLocalFile(localfile: str) -> PySide2.QtCore.QUrl

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#fromLocalFile

fromPercentEncoding

fromPercentEncoding(arg__1: Any) -> str

X.fromPercentEncoding(arg__1) -> str

Supplemental documentation: Qt 5 reference:

[static] QString QUrl::fromPercentEncoding(const QByteArray \&input)

Returns a decoded copy of input. input is first decoded from percent encoding, then converted from UTF-8 to unicode.

Note: Given invalid input (such as a string containing the sequence "%G5", which is not a valid hexadecimal number) the output will be invalid as well. As an example: the sequence "%G5" could be decoded to 'W'.

Upstream PySide2 reference signatures (binding differences may apply):

fromPercentEncoding(arg__1: PySide2.QtCore.QByteArray) -> str

Source: https://doc.qt.io/archives/qt-5.15/qurl.html#fromPercentEncoding