Obsolete Members for QUrl
The following members of class QUrl are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
Public Functions
(obsolete) void | addEncodedQueryItem(const QByteArray &key, const QByteArray &value) |
(obsolete) void | addQueryItem(const QString &key, const QString &value) |
(obsolete) QList<QByteArray> | allEncodedQueryItemValues(const QByteArray &key) const |
(obsolete) QStringList | allQueryItemValues(const QString &key) const |
(obsolete) QByteArray | encodedFragment() const |
(obsolete) QByteArray | encodedHost() const |
(obsolete) QByteArray | encodedPassword() const |
(obsolete) QByteArray | encodedPath() const |
(obsolete) QByteArray | encodedQuery() const |
(obsolete) QByteArray | encodedQueryItemValue(const QByteArray &key) const |
(obsolete) QList<QPair<QByteArray, QByteArray>> | encodedQueryItems() const |
(obsolete) QByteArray | encodedUserName() const |
(obsolete) bool | hasEncodedQueryItem(const QByteArray &key) const |
(obsolete) bool | hasQueryItem(const QString &key) const |
(obsolete) QString | queryItemValue(const QString &key) const |
(obsolete) QList<QPair<QString, QString>> | queryItems() const |
(obsolete) void | removeAllEncodedQueryItems(const QByteArray &key) |
(obsolete) void | removeAllQueryItems(const QString &key) |
(obsolete) void | removeEncodedQueryItem(const QByteArray &key) |
(obsolete) void | removeQueryItem(const QString &key) |
(obsolete) void | setEncodedFragment(const QByteArray &fragment) |
(obsolete) void | setEncodedHost(const QByteArray &host) |
(obsolete) void | setEncodedPassword(const QByteArray &password) |
(obsolete) void | setEncodedPath(const QByteArray &path) |
(obsolete) void | setEncodedQuery(const QByteArray &query) |
(obsolete) void | setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray>> &query) |
(obsolete) void | setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode = TolerantMode) |
(obsolete) void | setEncodedUserName(const QByteArray &userName) |
(obsolete) void | setQueryItems(const QList<QPair<QString, QString>> &query) |
(obsolete) QString | topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const |
Static Public Members
(obsolete) QString | fromPunycode(const QByteArray &pc) |
(obsolete) QByteArray | toPunycode(const QString &uc) |
Member Function Documentation
void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Inserts the pair key = value into the query string of the URL.
This function was introduced in Qt 4.4.
See also addQueryItem().
void QUrl::addQueryItem(const QString &key, const QString &value)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Inserts the pair key = value into the query string of the URL.
The key-value pair is encoded before it is added to the query. The pair is converted into separate strings internally. The key and value is first encoded into UTF-8 and then delimited by the character returned by queryValueDelimiter(). Each key-value pair is delimited by the character returned by queryPairDelimiter()
Note: This method does not encode spaces (ASCII 0x20) as plus (+) signs, like HTML forms do. If you need that kind of encoding, you must encode the value yourself and use QUrl::addEncodedQueryItem.
See also addEncodedQueryItem().
QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the a list of query string values whose key is equal to key from the URL.
Use QUrlQuery.
This function was introduced in Qt 4.4.
See also allQueryItemValues(), queryItemValue(), and encodedQueryItemValue().
QStringList QUrl::allQueryItemValues(const QString &key) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the a list of query string values whose key is equal to key from the URL.
Note: This method does not decode spaces plus (+) signs as spaces (ASCII 0x20), like HTML forms do. If you need that kind of decoding, you must use QUrl::allEncodedQueryItemValues and decode the data yourself.
Use QUrlQuery.
See also queryItemValue().
QByteArray QUrl::encodedFragment() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the fragment of the URL if it is defined; otherwise an empty string is returned. The returned value will have its non-ASCII and other control characters percent-encoded, as in toEncoded().
Use query(QUrl::FullyEncoded).toLatin1().
This function was introduced in Qt 4.4.
See also setEncodedFragment() and toEncoded().
QByteArray QUrl::encodedHost() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the host part of the URL if it is defined; otherwise an empty string is returned.
Note: encodedHost() does not return percent-encoded hostnames. Instead, the ACE-encoded (bare ASCII in Punycode encoding) form will be returned for any non-ASCII hostname.
This function is equivalent to calling QUrl::toAce() on the return value of host().
Use host(QUrl::FullyEncoded).toLatin1() or toAce(host()).
This function was introduced in Qt 4.4.
See also setEncodedHost().
QByteArray QUrl::encodedPassword() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the password of the URL if it is defined; otherwise an empty string is returned. The returned value will have its non-ASCII and other control characters percent-encoded, as in toEncoded().
Use password(QUrl::FullyEncoded).toLatin1()
This function was introduced in Qt 4.4.
See also setEncodedPassword() and toEncoded().
QByteArray QUrl::encodedPath() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the path of the URL if it is defined; otherwise an empty string is returned. The returned value will have its non-ASCII and other control characters percent-encoded, as in toEncoded().
Use path(QUrl::FullyEncoded).toLatin1().
This function was introduced in Qt 4.4.
See also setEncodedPath() and toEncoded().
QByteArray QUrl::encodedQuery() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the query string of the URL in percent encoded form.
Use query(QUrl::FullyEncoded).toLatin1()
See also setEncodedQuery() and query().
QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the first query string value whose key is equal to key from the URL.
Use QUrlQuery.
This function was introduced in Qt 4.4.
See also queryItemValue() and allQueryItemValues().
QList<QPair<QByteArray, QByteArray>> QUrl::encodedQueryItems() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the query string of the URL, as a map of encoded keys and values.
Use QUrlQuery.
This function was introduced in Qt 4.4.
See also setEncodedQueryItems(), setQueryItems(), and setEncodedQuery().
QByteArray QUrl::encodedUserName() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the user name of the URL if it is defined; otherwise an empty string is returned. The returned value will have its non-ASCII and other control characters percent-encoded, as in toEncoded().
Use userName(QUrl::FullyEncoded).toLatin1()
This function was introduced in Qt 4.4.
See also setEncodedUserName().
[static]
QString QUrl::fromPunycode(const QByteArray &pc)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the Punycode decoded representation of pc.
Punycode is a Unicode encoding used for internationalized domain names, as defined in RFC3492. If you want to convert a domain from its ASCII-compatible encoding to the Unicode representation, use fromAce().
bool QUrl::hasEncodedQueryItem(const QByteArray &key) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns true
if there is a query string pair whose key is equal to key from the URL.
Use QUrlQuery.
This function was introduced in Qt 4.4.
See also hasQueryItem().
bool QUrl::hasQueryItem(const QString &key) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns true
if there is a query string pair whose key is equal to key from the URL.
Use QUrlQuery.
See also hasEncodedQueryItem().
QString QUrl::queryItemValue(const QString &key) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the first query string value whose key is equal to key from the URL.
Note: This method does not decode spaces plus (+) signs as spaces (ASCII 0x20), like HTML forms do. If you need that kind of decoding, you must use QUrl::encodedQueryItemValue and decode the data yourself.
Use QUrlQuery.
See also allQueryItemValues().
QList<QPair<QString, QString>> QUrl::queryItems() const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the query string of the URL, as a map of keys and values.
Note: This method does not decode spaces plus (+) signs as spaces (ASCII 0x20), like HTML forms do. If you need that kind of decoding, you must use QUrl::encodedQueryItems and decode the data yourself.
Use QUrlQuery.
See also setQueryItems() and setEncodedQuery().
void QUrl::removeAllEncodedQueryItems(const QByteArray &key)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Removes all the query string pairs whose key is equal to key from the URL.
Use QUrlQuery.
This function was introduced in Qt 4.4.
See also removeQueryItem().
void QUrl::removeAllQueryItems(const QString &key)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Removes all the query string pairs whose key is equal to key from the URL.
Use QUrlQuery.
See also removeQueryItem().
void QUrl::removeEncodedQueryItem(const QByteArray &key)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Removes the first query string pair whose key is equal to key from the URL.
Use QUrlQuery.
This function was introduced in Qt 4.4.
See also removeQueryItem() and removeAllQueryItems().
void QUrl::removeQueryItem(const QString &key)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Removes the first query string pair whose key is equal to key from the URL.
Use QUrlQuery.
See also removeAllQueryItems().
void QUrl::setEncodedFragment(const QByteArray &fragment)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the URL's fragment to the percent-encoded fragment. The fragment is the last part of the URL, represented by a '#' followed by a string of characters. It is typically used in HTTP for referring to a certain link or point on a page:
The fragment is sometimes also referred to as the URL "reference".
Passing an argument of QByteArray() (a null QByteArray) will unset the fragment. Passing an argument of QByteArray("") (an empty but not null QByteArray) will set the fragment to an empty string (as if the original URL had a lone "#").
Use setFragment(), which has the same behavior of null / empty.
This function was introduced in Qt 4.4.
See also setFragment() and encodedFragment().
void QUrl::setEncodedHost(const QByteArray &host)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the URL's host to the ACE- or percent-encoded host. The host is part of the user info element in the authority of the URL, as described in setAuthority().
Use setHost(QString::fromUtf8(host)).
This function was introduced in Qt 4.4.
See also setHost(), encodedHost(), setAuthority(), and fromAce().
void QUrl::setEncodedPassword(const QByteArray &password)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the URL's password to the percent-encoded password. The password is part of the user info element in the authority of the URL, as described in setUserInfo().
Use setPassword(QString::fromUtf8(password));
This function was introduced in Qt 4.4.
See also setPassword(), encodedPassword(), and setUserInfo().
void QUrl::setEncodedPath(const QByteArray &path)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the URL's path to the percent-encoded path. The path is the part of the URL that comes after the authority but before the query string.
For non-hierarchical schemes, the path will be everything following the scheme declaration, as in the following example:
Use setPath(QString::fromUtf8(path)).
This function was introduced in Qt 4.4.
See also setPath(), encodedPath(), and setUserInfo().
void QUrl::setEncodedQuery(const QByteArray &query)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the query string of the URL to query. The string is inserted as-is, and no further encoding is performed when calling toEncoded().
This function is useful if you need to pass a query string that does not fit into the key-value pattern, or that uses a different scheme for encoding special characters than what is suggested by QUrl.
Passing a value of QByteArray() to query (a null QByteArray) unsets the query completely. However, passing a value of QByteArray("") will set the query to an empty value, as if the original URL had a lone "?".
Use setQuery, which has the same null / empty behavior.
See also encodedQuery() and hasQuery().
void QUrl::setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray>> &query)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the query string of the URL to the encoded version of query. The contents of query are converted to a string internally, each pair delimited by the character returned by queryPairDelimiter(), and the key and value are delimited by queryValueDelimiter().
This function was introduced in Qt 4.4.
See also encodedQueryItems() and setQueryItems().
void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode = TolerantMode)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Constructs a URL by parsing the contents of encodedUrl.
encodedUrl is assumed to be a URL string in percent encoded form, containing only ASCII characters.
The parsing mode parsingMode is used for parsing encodedUrl.
Use setUrl(QString::fromUtf8(encodedUrl), parsingMode)
See also setUrl().
void QUrl::setEncodedUserName(const QByteArray &userName)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the URL's user name to the percent-encoded userName. The userName is part of the user info element in the authority of the URL, as described in setUserInfo().
Use setUserName(QString::fromUtf8(userName))
This function was introduced in Qt 4.4.
See also setUserName(), encodedUserName(), and setUserInfo().
void QUrl::setQueryItems(const QList<QPair<QString, QString>> &query)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the query string of the URL to an encoded version of query. The contents of query are converted to a string internally, each pair delimited by the character returned by queryPairDelimiter(), and the key and value are delimited by queryValueDelimiter()
Note: This method does not encode spaces (ASCII 0x20) as plus (+) signs, like HTML forms do. If you need that kind of encoding, you must encode the value yourself and use QUrl::setEncodedQueryItems.
See also queryItems() and setEncodedQueryItems().
[static]
QByteArray QUrl::toPunycode(const QString &uc)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns a uc in Punycode encoding.
Punycode is a Unicode encoding used for internationalized domain names, as defined in RFC3492. If you want to convert a domain name from Unicode to its ASCII-compatible representation, use toAce().
QString QUrl::topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk, .net). Note that the return value is prefixed with a '.' unless the URL does not contain a valid TLD, in which case the function returns an empty string.
Note that this function considers a TLD to be any domain that allows users to register subdomains under, including many home, dynamic DNS websites and blogging providers. This is useful for determining whether two websites belong to the same infrastructure and communication should be allowed, such as browser cookies: two domains should be considered part of the same website if they share at least one label in addition to the value returned by this function.
foo.co.uk
andfoo.com
do not share a top-level domainfoo.co.uk
andbar.co.uk
share the.co.uk
domain, but the next label is differentwww.foo.co.uk
andftp.foo.co.uk
share the same top-level domain and one more label, so they are considered part of the same site
If options includes EncodeUnicode, the returned string will be in ASCII Compatible Encoding.
This function was introduced in Qt 4.8.