Member Function Documentation
QUrlQuery::QUrlQuery()
Constructs an empty QUrlQuery object. A query can be set afterwards by calling setQuery() or items can be added by using addQueryItem().
See also setQuery() and addQueryItem().
QUrlQuery::QUrlQuery(const QUrl & url)
Constructs a QUrlQuery object and parses the query string found in the url URL, using the default query delimiters. To parse a query string using other delimiters, you should first set them using setQueryDelimiters() and then set the query with setQuery().
See also QUrl::query().
QUrlQuery::QUrlQuery(const QString & queryString)
Constructs a QUrlQuery object and parses the queryString query string, using the default query delimiters. To parse a query string using other delimiters, you should first set them using setQueryDelimiters() and then set the query with setQuery().
QUrlQuery::QUrlQuery(const QUrlQuery & other)
Copies the contents of the other QUrlQuery object, including the query delimiters.
QUrlQuery::~QUrlQuery()
Destroys this QUrlQuery object.
void QUrlQuery::addQueryItem(const QString & key, const QString & value)
Appends the pair key = value to the end of the query string of the URL. This method does not overwrite existing items that might exist with the same key.
Note: This method does not treat spaces (ASCII 0x20) and plus ("+") signs as the same, like HTML forms do. If you need spaces to be represented as plus signs, use actual plus signs.
See also hasQueryItem() and queryItemValue().
Returns the a list of query string values whose key is equal to key from the URL, using the options specified in encoding to encode the return value. If the key key is not found, this function returns an empty list.
See also queryItemValue() and addQueryItem().
void QUrlQuery::clear()
Clears this QUrlQuery object by removing all of the key-value pairs currently stored. If the query delimiters have been changed, this function will leave them with their changed values.
See also isEmpty() and setQueryDelimiters().
DataPtr & QUrlQuery::data_ptr()
QChar QUrlQuery::defaultQueryPairDelimiter() [static]
Returns the default character for separating keys-value pairs from each other, an ampersand ("&").
See also setQueryDelimiters(), queryPairDelimiter(), and defaultQueryValueDelimiter().
QChar QUrlQuery::defaultQueryValueDelimiter() [static]
Returns the default character for separating keys from values in the query, an equal sign ("=").
See also setQueryDelimiters(), queryValueDelimiter(), and defaultQueryPairDelimiter().
bool QUrlQuery::hasQueryItem(const QString & key) const
Returns true if there is a query string pair whose key is equal to key from the URL.
See also addQueryItem() and queryItemValue().
bool QUrlQuery::isEmpty() const
Returns true if this QUrlQUery object contains no key-value pairs, such as after being default-constructed or after parsing an empty query string.
See also setQuery() and clear().
Returns the reconstructed query string, formed from the key-value pairs currently stored in this QUrlQuery object and separated by the query delimiters chosen for this object. The keys and values are encoded using the options given by the encoding paramter.
For this function, the only ambiguous delimiter is the hash ("#"), as in URLs it is used to separate the query string from the fragment that may follow.
The order of the key-value pairs in the returned string is exactly the same as in the original query.
See also setQuery(), QUrl::setQuery(), QUrl::fragment(), and l{#Encoding}{Encoding}.
Returns the query value associated with key key from the URL, using the options specified in encoding to encode the return value. If the key key is not found, this function returns an empty string. If you need to distinguish between an empty value and a non-existent key, you should check for the key's presence first using hasQueryItem().
If the key key is multiply defined, this function will return the first one found, in the order they were present in the query string or added using addQueryItem().
See also addQueryItem(), allQueryItemValues(), and l{#Encoding}{Encoding}.
Returns the query string of the URL, as a map of keys and values, using the options specified in encoding to encode the items. The order of the elements is the same as the one found in the query string or set with setQueryItems().
See also setQueryItems() and l{#Encoding}{Encoding}.
QChar QUrlQuery::queryPairDelimiter() const
Returns the character used to delimit between keys-value pairs when reconstructing the query string in query() or when parsing in setQuery().
See also setQueryDelimiters() and queryValueDelimiter().
QChar QUrlQuery::queryValueDelimiter() const
Returns the character used to delimit between keys and values when reconstructing the query string in query() or when parsing in setQuery().
See also setQueryDelimiters() and queryPairDelimiter().
void QUrlQuery::removeAllQueryItems(const QString & key)
Removes all the query string pairs whose key is equal to key from the URL.
See also removeQueryItem().
void QUrlQuery::removeQueryItem(const QString & key)
Removes the query string pair whose key is equal to key from the URL. If there are multiple items with a key equal to key, it removes the first item in the order they were present in the query string or added with addQueryItem().
See also removeAllQueryItems().
void QUrlQuery::setQuery(const QString & queryString)
Parses the query string in queryString and sets the internal items to the values found there. If any delimiters have been specified with setQueryDelimiters(), this function will use them instead of the default delimiters to parse the string.
See also query().
void QUrlQuery::setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter)
Sets the characters used for delimiting between keys and values, and between key-value pairs in the URL's query string. The default value delimiter is '=' and the default pair delimiter is '&'.
valueDelimiter will be used for separating keys from values, and pairDelimiter will be used to separate key-value pairs. Any occurrences of these delimiting characters in the encoded representation of the keys and values of the query string are percent encoded when returned in query().
If valueDelimiter is set to '(' and pairDelimiter is ')', the above query string would instead be represented like this:
http:
Note: Non-standard delimiters should be chosen from among what RFC 3986 calls "sub-delimiters". They are:
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Use of other characters is not supported and may result in unexpected behaviour. This method does not verify that you passed a valid delimiter.
See also queryValueDelimiter() and queryPairDelimiter().
void QUrlQuery::setQueryItems(const QList<QPair<QString, QString> > & query)
Sets the items in this QUrlQuery object to query. The order of the elements in query is preserved.
Note: This method does not treat spaces (ASCII 0x20) and plus ("+") signs as the same, like HTML forms do. If you need spaces to be represented as plus signs, use actual plus signs.
See also queryItems() and isEmpty().
void QUrlQuery::swap(QUrlQuery & other)
bool QUrlQuery::operator!=(const QUrlQuery & other) const
QUrlQuery & QUrlQuery::operator=(const QUrlQuery & other)
Copies the contents of the other QUrlQuery object, including the query delimiters.
bool QUrlQuery::operator==(const QUrlQuery & other) const
Returns true if this object and the other object contain the same contents, in the same order, and use the same query delimiters.