#include "qdir.h" // for QDir::fromNativeSeparators
#include "qtldurl_p.h"
#include "private/qipaddress_p.h"
+#include "qurlquery.h"
#if defined(Q_OS_WINCE_WM)
#pragma optimize("g", off)
#endif
d->sectionIsPresent &= ~QUrlPrivate::Query;
}
+void QUrl::setQuery(const QUrlQuery &query)
+{
+ detach();
+
+ // we know the data is in the right format
+ d->query = query.toString();
+ if (query.isEmpty())
+ d->sectionIsPresent &= ~QUrlPrivate::Query;
+ else
+ d->sectionIsPresent |= QUrlPrivate::Query;
+}
+
/*!
Returns the query string of the URL in percent encoded form.
*/
QT_BEGIN_NAMESPACE
+class QUrlQuery;
class QUrlPrivate;
class QDataStream;
bool hasQuery() const;
void setQuery(const QString &query);
+ void setQuery(const QUrlQuery &query);
QString query(ComponentFormattingOptions = PrettyDecoded) const;
bool hasFragment() const;
#if QT_DEPRECATED_SINCE(5,0)
inline void QUrl::setQueryItems(const QList<QPair<QString, QString> > &qry)
-{ QUrlQuery q(*this); q.setQueryItems(qry); setQuery(q.query()); }
+{ QUrlQuery q(*this); q.setQueryItems(qry); setQuery(q); }
inline void QUrl::addQueryItem(const QString &key, const QString &value)
-{ QUrlQuery q(*this); q.addQueryItem(key, value); setQuery(q.query()); }
+{ QUrlQuery q(*this); q.addQueryItem(key, value); setQuery(q); }
inline QList<QPair<QString, QString> > QUrl::queryItems() const
{ return QUrlQuery(*this).queryItems(); }
inline bool QUrl::hasQueryItem(const QString &key) const
inline QStringList QUrl::allQueryItemValues(const QString &key) const
{ return QUrlQuery(*this).allQueryItemValues(key); }
inline void QUrl::removeQueryItem(const QString &key)
-{ QUrlQuery q(*this); q.removeQueryItem(key); setQuery(q.query()); }
+{ QUrlQuery q(*this); q.removeQueryItem(key); setQuery(q); }
inline void QUrl::removeAllQueryItems(const QString &key)
{ QUrlQuery q(*this); q.removeAllQueryItems(key); }
#endif