Obsolete Members for QUrl

以下成员源于类 QUrl 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

(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 fromPunycode (const QByteArray & pc )
(obsolete) QByteArray toPunycode (const QString & uc )

成员函数文档编制

void QUrl:: addEncodedQueryItem (const QByteArray & key , const QByteArray & value )

Inserts the pair key = value into the query string of the URL.

该函数在 Qt 4.4 引入。

另请参阅 addQueryItem ().

void QUrl:: addQueryItem (const QString & key , const QString & value )

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

注意: 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 .

另请参阅 addEncodedQueryItem ().

QList < QByteArray > QUrl:: allEncodedQueryItemValues (const QByteArray & key ) const

Returns the a list of query string values whose key is equal to key from the URL.

该函数在 Qt 4.4 引入。

另请参阅 allQueryItemValues (), queryItemValue (),和 encodedQueryItemValue ().

QStringList QUrl:: allQueryItemValues (const QString & key ) const

Returns the a list of query string values whose key is equal to key from the URL.

注意: 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.

另请参阅 queryItemValue ().

QByteArray QUrl:: encodedFragment () const

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

该函数在 Qt 4.4 引入。

另请参阅 setEncodedFragment () 和 toEncoded ().

QByteArray QUrl:: encodedHost () const

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.

此函数相当于调用 QUrl::toAce () on the return value of host ().

该函数在 Qt 4.4 引入。

另请参阅 setEncodedHost ().

QByteArray QUrl:: encodedPassword () const

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

该函数在 Qt 4.4 引入。

另请参阅 setEncodedPassword () 和 toEncoded ().

QByteArray QUrl:: encodedPath () const

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

该函数在 Qt 4.4 引入。

另请参阅 setEncodedPath () 和 toEncoded ().

QByteArray QUrl:: encodedQuery () const

Returns the query string of the URL in percent encoded form.

另请参阅 setEncodedQuery () 和 query ().

QByteArray QUrl:: encodedQueryItemValue (const QByteArray & key ) const

Returns the first query string value whose key is equal to key from the URL.

该函数在 Qt 4.4 引入。

另请参阅 queryItemValue () 和 allQueryItemValues ().

QList < QPair < QByteArray , QByteArray > > QUrl:: encodedQueryItems () const

Returns the query string of the URL, as a map of encoded keys and values.

该函数在 Qt 4.4 引入。

另请参阅 setEncodedQueryItems (), setQueryItems (),和 setEncodedQuery ().

QByteArray QUrl:: encodedUserName () const

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

该函数在 Qt 4.4 引入。

另请参阅 setEncodedUserName ().

[static] QString QUrl:: fromPunycode (const QByteArray & pc )

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

返回 true if there is a query string pair whose key is equal to key from the URL.

该函数在 Qt 4.4 引入。

另请参阅 hasQueryItem ().

bool QUrl:: hasQueryItem (const QString & key ) const

返回 true if there is a query string pair whose key is equal to key from the URL.

另请参阅 hasEncodedQueryItem ().

QString QUrl:: queryItemValue (const QString & key ) const

Returns the first query string value whose key is equal to key from the URL.

注意: 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.

另请参阅 allQueryItemValues ().

QList < QPair < QString , QString > > QUrl:: queryItems () const

Returns the query string of the URL, as a map of keys and values.

注意: 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.

另请参阅 setQueryItems () 和 setEncodedQuery ().

void QUrl:: removeAllEncodedQueryItems (const QByteArray & key )

Removes all the query string pairs whose key is equal to key from the URL.

该函数在 Qt 4.4 引入。

另请参阅 removeQueryItem ().

void QUrl:: removeAllQueryItems (const QString & key )

Removes all the query string pairs whose key is equal to key from the URL.

另请参阅 removeQueryItem ().

void QUrl:: removeEncodedQueryItem (const QByteArray & key )

Removes the first query string pair whose key is equal to key from the URL.

该函数在 Qt 4.4 引入。

另请参阅 removeQueryItem () 和 removeAllQueryItems ().

void QUrl:: removeQueryItem (const QString & key )

Removes the first query string pair whose key is equal to key from the URL.

另请参阅 removeAllQueryItems ().

void QUrl:: setEncodedFragment (const QByteArray & fragment )

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 "#").

该函数在 Qt 4.4 引入。

另请参阅 setFragment () 和 encodedFragment ().

void QUrl:: setEncodedHost (const QByteArray & host )

Sets the URL's host to the ACE- or percent-encoded host host is part of the user info element in the authority of the URL, as described in setAuthority ().

该函数在 Qt 4.4 引入。

另请参阅 setHost (), encodedHost (), setAuthority (),和 fromAce ().

void QUrl:: setEncodedPassword (const QByteArray & password )

Sets the URL's password to the percent-encoded password password is part of the user info element in the authority of the URL, as described in setUserInfo ().

该函数在 Qt 4.4 引入。

另请参阅 setPassword (), encodedPassword (),和 setUserInfo ().

void QUrl:: setEncodedPath (const QByteArray & path )

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:

该函数在 Qt 4.4 引入。

另请参阅 setPath (), encodedPath (),和 setUserInfo ().

void QUrl:: setEncodedQuery (const QByteArray & query )

将 URL 查询字符串设为 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 "?".

另请参阅 encodedQuery () 和 hasQuery ().

void QUrl:: setEncodedQueryItems (const QList < QPair < QByteArray , QByteArray > > & query )

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

该函数在 Qt 4.4 引入。

另请参阅 encodedQueryItems () 和 setQueryItems ().

void QUrl:: setEncodedUrl (const QByteArray & encodedUrl , ParsingMode parsingMode = TolerantMode)

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 .

另请参阅 setUrl ().

void QUrl:: setEncodedUserName (const QByteArray & userName )

Sets the URL's user name to the percent-encoded userName userName is part of the user info element in the authority of the URL, as described in setUserInfo ().

该函数在 Qt 4.4 引入。

另请参阅 setUserName (), encodedUserName (),和 setUserInfo ().

void QUrl:: setQueryItems (const QList < QPair < QString , QString > > & query )

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

注意: 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 .

另请参阅 queryItems () 和 setEncodedQueryItems ().

[static] QByteArray QUrl:: toPunycode (const QString & uc )

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