Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 5414

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qurl.cpp -->
<head>
  <title>Qt 4.6: QUrl Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QUrl"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QUrl Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span>
</h1>
<p>The QUrl class provides a convenient interface for working with URLs. <a href="#details">More...</a></p>
<pre> #include &lt;QUrl&gt;</pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qurl-members.html">List of all members, including inherited members</a></li>
<li><a href="qurl-obsolete.html">Obsolete members</a></li>
<li><a href="qurl-qt3.html">Qt 3 support members</a></li>
</ul>
<hr />
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#FormattingOption-enum">FormattingOption</a></b> { None, RemoveScheme, RemovePassword, RemoveUserInfo, ..., StripTrailingSlash }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#FormattingOption-enum">FormattingOptions</a></b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#ParsingMode-enum">ParsingMode</a></b> { TolerantMode, StrictMode }</td></tr>
</table>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#QUrl">QUrl</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#QUrl-2">QUrl</a></b> ( const QString &amp; <i>url</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#QUrl-3">QUrl</a></b> ( const QUrl &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#QUrl-4">QUrl</a></b> ( const QString &amp; <i>url</i>, ParsingMode <i>parsingMode</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#dtor.QUrl">~QUrl</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#addEncodedQueryItem">addEncodedQueryItem</a></b> ( const QByteArray &amp; <i>key</i>, const QByteArray &amp; <i>value</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#addQueryItem">addQueryItem</a></b> ( const QString &amp; <i>key</i>, const QString &amp; <i>value</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QByteArray&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#allEncodedQueryItemValues">allEncodedQueryItemValues</a></b> ( const QByteArray &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#allQueryItemValues">allQueryItemValues</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#authority">authority</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedFragment">encodedFragment</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedHost">encodedHost</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedPassword">encodedPassword</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedPath">encodedPath</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedQuery">encodedQuery</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedQueryItemValue">encodedQueryItemValue</a></b> ( const QByteArray &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QPair&lt;QByteArray, QByteArray&gt; &gt; </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedQueryItems">encodedQueryItems</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#encodedUserName">encodedUserName</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#errorString">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#fragment">fragment</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#hasEncodedQueryItem">hasEncodedQueryItem</a></b> ( const QByteArray &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#hasFragment">hasFragment</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#hasQuery">hasQuery</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#hasQueryItem">hasQueryItem</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#host">host</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#isParentOf">isParentOf</a></b> ( const QUrl &amp; <i>childUrl</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#isRelative">isRelative</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#isValid">isValid</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#password">password</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#path">path</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#port">port</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#port-2">port</a></b> ( int <i>defaultPort</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#queryItemValue">queryItemValue</a></b> ( const QString &amp; <i>key</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QPair&lt;QString, QString&gt; &gt; </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#queryItems">queryItems</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#queryPairDelimiter">queryPairDelimiter</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#queryValueDelimiter">queryValueDelimiter</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#removeAllEncodedQueryItems">removeAllEncodedQueryItems</a></b> ( const QByteArray &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a></b> ( const QString &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#removeEncodedQueryItem">removeEncodedQueryItem</a></b> ( const QByteArray &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#removeQueryItem">removeQueryItem</a></b> ( const QString &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#resolved">resolved</a></b> ( const QUrl &amp; <i>relative</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#scheme">scheme</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setAuthority">setAuthority</a></b> ( const QString &amp; <i>authority</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedFragment">setEncodedFragment</a></b> ( const QByteArray &amp; <i>fragment</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedHost">setEncodedHost</a></b> ( const QByteArray &amp; <i>host</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedPassword">setEncodedPassword</a></b> ( const QByteArray &amp; <i>password</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedPath">setEncodedPath</a></b> ( const QByteArray &amp; <i>path</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedQuery">setEncodedQuery</a></b> ( const QByteArray &amp; <i>query</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedQueryItems">setEncodedQueryItems</a></b> ( const QList&lt;QPair&lt;QByteArray, QByteArray&gt; &gt; &amp; <i>query</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedUrl">setEncodedUrl</a></b> ( const QByteArray &amp; <i>encodedUrl</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedUrl-2">setEncodedUrl</a></b> ( const QByteArray &amp; <i>encodedUrl</i>, ParsingMode <i>parsingMode</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setEncodedUserName">setEncodedUserName</a></b> ( const QByteArray &amp; <i>userName</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setFragment">setFragment</a></b> ( const QString &amp; <i>fragment</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setHost">setHost</a></b> ( const QString &amp; <i>host</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setPassword">setPassword</a></b> ( const QString &amp; <i>password</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setPath">setPath</a></b> ( const QString &amp; <i>path</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setPort">setPort</a></b> ( int <i>port</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a></b> ( char <i>valueDelimiter</i>, char <i>pairDelimiter</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setQueryItems">setQueryItems</a></b> ( const QList&lt;QPair&lt;QString, QString&gt; &gt; &amp; <i>query</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setScheme">setScheme</a></b> ( const QString &amp; <i>scheme</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setUrl">setUrl</a></b> ( const QString &amp; <i>url</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setUrl-2">setUrl</a></b> ( const QString &amp; <i>url</i>, ParsingMode <i>parsingMode</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setUserInfo">setUserInfo</a></b> ( const QString &amp; <i>userInfo</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setUserName">setUserName</a></b> ( const QString &amp; <i>userName</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#toEncoded">toEncoded</a></b> ( FormattingOptions <i>options</i> = None ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#toLocalFile">toLocalFile</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#toString">toString</a></b> ( FormattingOptions <i>options</i> = None ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#userInfo">userInfo</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#userName">userName</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#operator-not-eq">operator!=</a></b> ( const QUrl &amp; <i>url</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#operator-eq">operator=</a></b> ( const QUrl &amp; <i>url</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#operator-eq-2">operator=</a></b> ( const QString &amp; <i>url</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#operator-eq-eq">operator==</a></b> ( const QUrl &amp; <i>url</i> ) const</td></tr>
</table>
<hr />
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#fromAce">fromAce</a></b> ( const QByteArray &amp; <i>domain</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#fromEncoded">fromEncoded</a></b> ( const QByteArray &amp; <i>input</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#fromEncoded-2">fromEncoded</a></b> ( const QByteArray &amp; <i>input</i>, ParsingMode <i>parsingMode</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#fromLocalFile">fromLocalFile</a></b> ( const QString &amp; <i>localFile</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#fromPercentEncoding">fromPercentEncoding</a></b> ( const QByteArray &amp; <i>input</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#fromUserInput">fromUserInput</a></b> ( const QString &amp; <i>userInput</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#idnWhitelist">idnWhitelist</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a></b> ( const QStringList &amp; <i>list</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#toAce">toAce</a></b> ( const QString &amp; <i>domain</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QByteArray </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#toPercentEncoding">toPercentEncoding</a></b> ( const QString &amp; <i>input</i>, const QByteArray &amp; <i>exclude</i> = QByteArray(), const QByteArray &amp; <i>include</i> = QByteArray() )</td></tr>
</table>
<hr />
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QDataStream &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#operator-lt-lt-192">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>out</i>, const QUrl &amp; <i>url</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QDataStream &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#operator-gt-gt-108">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>in</i>, QUrl &amp; <i>url</i> )</td></tr>
</table>
<hr />
<a name="macros"></a>
<h2>Macros</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qurl.html#QT_NO_URL_CAST_FROM_STRING">QT_NO_URL_CAST_FROM_STRING</a></b></td></tr>
</table>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QUrl class provides a convenient interface for working with URLs.</p>
<p>It can parse and construct URLs in both encoded and unencoded form. QUrl also has support for internationalized domain names (IDNs).</p>
<p>The most common way to use QUrl is to initialize it via the constructor by passing a <a href="qstring.html">QString</a>. Otherwise, <a href="qurl.html#setUrl">setUrl</a>() and <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>() can also be used.</p>
<p>URLs can be represented in two forms: encoded or unencoded. The unencoded representation is suitable for showing to users, but the encoded representation is typically what you would send to a web server. For example, the unencoded URL &quot;http://b&uuml;<tt></tt>hler.example.com&quot; would be sent to the server as &quot;http://xn--bhler-kva.example.com/List%20of%20applicants.xml&quot;.</p>
<p>A URL can also be constructed piece by piece by calling <a href="qurl.html#setScheme">setScheme</a>(), <a href="qurl.html#setUserName">setUserName</a>(), <a href="qurl.html#setPassword">setPassword</a>(), <a href="qurl.html#setHost">setHost</a>(), <a href="qurl.html#setPort">setPort</a>(), <a href="qurl.html#setPath">setPath</a>(), <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>() and <a href="qurl.html#setFragment">setFragment</a>(). Some convenience functions are also available: <a href="qurl.html#setAuthority">setAuthority</a>() sets the user name, password, host and port. <a href="qurl.html#setUserInfo">setUserInfo</a>() sets the user name and password at once.</p>
<p>Call <a href="qurl.html#isValid">isValid</a>() to check if the URL is valid. This can be done at any point during the constructing of a URL.</p>
<p>Constructing a query is particularly convenient through the use of <a href="qurl.html#setQueryItems">setQueryItems</a>(), <a href="qurl.html#addQueryItem">addQueryItem</a>() and <a href="qurl.html#removeQueryItem">removeQueryItem</a>(). Use <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>() to customize the delimiters used for generating the query string.</p>
<p>For the convenience of generating encoded URL strings or query strings, there are two static functions called <a href="qurl.html#fromPercentEncoding">fromPercentEncoding</a>() and <a href="qurl.html#toPercentEncoding">toPercentEncoding</a>() which deal with percent encoding and decoding of QStrings.</p>
<p>Calling <a href="qurl.html#isRelative">isRelative</a>() will tell whether or not the URL is relative. A relative URL can be resolved by passing it as argument to <a href="qurl.html#resolved">resolved</a>(), which returns an absolute URL. <a href="qurl.html#isParentOf">isParentOf</a>() is used for determining whether one URL is a parent of another.</p>
<p><a href="qurl.html#fromLocalFile">fromLocalFile</a>() constructs a QUrl by parsing a local file path. <a href="qurl.html#toLocalFile">toLocalFile</a>() converts a URL to a local file path.</p>
<p>The human readable representation of the URL is fetched with <a href="qurl.html#toString">toString</a>(). This representation is appropriate for displaying a URL to a user in unencoded form. The encoded form however, as returned by <a href="qurl.html#toEncoded">toEncoded</a>(), is for internal use, passing to web servers, mail clients and so on.</p>
<p>QUrl conforms to the URI specification from <a href="http://www.rfc-editor.org/rfc/rfc3986.txt">RFC 3986</a> (Uniform Resource Identifier: Generic Syntax), and includes scheme extensions from <a href="http://www.rfc-editor.org/rfc/rfc1738.txt">RFC 1738</a> (Uniform Resource Locators). Case folding rules in QUrl conform to <a href="http://www.rfc-editor.org/rfc/rfc3491.txt">RFC 3491</a> (Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)).</p>
<p>See also <a href="qurlinfo.html">QUrlInfo</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<a name="//apple_ref/cpp/tag/QUrl/FormattingOption"></a>
<a name="//apple_ref/cpp/econst/QUrl/None"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemoveScheme"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemovePassword"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemoveUserInfo"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemovePort"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemoveAuthority"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemovePath"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemoveQuery"></a>
<a name="//apple_ref/cpp/econst/QUrl/RemoveFragment"></a>
<a name="//apple_ref/cpp/econst/QUrl/StripTrailingSlash"></a>
<a name="//apple_ref/cpp/tdef/QUrl/FormattingOptions"></a>
<h3 class="flags"><a name="FormattingOption-enum"></a>enum QUrl::FormattingOption<br />flags QUrl::FormattingOptions</h3>
<p>The formatting options define how the URL is formatted when written out as text.</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QUrl::None</tt></td><td align="center" valign="top"><tt>0x0</tt></td><td valign="top">The format of the URL is unchanged.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveScheme</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">The scheme is removed from the URL.</td></tr>
<tr><td valign="top"><tt>QUrl::RemovePassword</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">Any password in the URL is removed.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveUserInfo</tt></td><td align="center" valign="top"><tt>RemovePassword | 0x4</tt></td><td valign="top">Any user information in the URL is removed.</td></tr>
<tr><td valign="top"><tt>QUrl::RemovePort</tt></td><td align="center" valign="top"><tt>0x8</tt></td><td valign="top">Any specified port is removed from the URL.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveAuthority</tt></td><td align="center" valign="top"><tt>RemoveUserInfo | RemovePort | 0x10</tt></td><td valign="top">&nbsp;</td></tr>
<tr><td valign="top"><tt>QUrl::RemovePath</tt></td><td align="center" valign="top"><tt>0x20</tt></td><td valign="top">The URL's path is removed, leaving only the scheme, host address, and port (if present).</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveQuery</tt></td><td align="center" valign="top"><tt>0x40</tt></td><td valign="top">The query part of the URL (following a '?' character) is removed.</td></tr>
<tr><td valign="top"><tt>QUrl::RemoveFragment</tt></td><td align="center" valign="top"><tt>0x80</tt></td><td valign="top">&nbsp;</td></tr>
<tr><td valign="top"><tt>QUrl::StripTrailingSlash</tt></td><td align="center" valign="top"><tt>0x10000</tt></td><td valign="top">The trailing slash is removed if one is present.</td></tr>
</table></p>
<p>Note that the case folding rules in <a href="http://www.rfc-editor.org/rfc/rfc3491.txt">Nameprep</a>, which <a href="qurl.html">QUrl</a> conforms to, require host names to always be converted to lower case, regardless of the Qt::FormattingOptions used.</p>
<p>The FormattingOptions type is a typedef for <a href="qflags.html">QFlags</a>&lt;FormattingOption&gt;. It stores an OR combination of FormattingOption values.</p>
<a name="//apple_ref/cpp/tag/QUrl/ParsingMode"></a>
<a name="//apple_ref/cpp/econst/QUrl/TolerantMode"></a>
<a name="//apple_ref/cpp/econst/QUrl/StrictMode"></a>
<h3 class="fn"><a name="ParsingMode-enum"></a>enum QUrl::ParsingMode</h3>
<p>The parsing mode controls the way <a href="qurl.html">QUrl</a> parses strings.</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QUrl::TolerantMode</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top"><a href="qurl.html">QUrl</a> will try to correct some common errors in URLs. This mode is useful when processing URLs entered by users.</td></tr>
<tr><td valign="top"><tt>QUrl::StrictMode</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Only valid URLs are accepted. This mode is useful for general URL validation.</td></tr>
</table></p>
<p>In TolerantMode, the parser corrects the following invalid input:</p>
<ul>
<li>Spaces and &quot;%20&quot;: If an encoded URL contains a space, this will be replaced with &quot;%20&quot;. If a decoded URL contains &quot;%20&quot;, this will be replaced with a single space before the URL is parsed.</li>
<li>Single &quot;%&quot; characters: Any occurrences of a percent character &quot;%&quot; not followed by exactly two hexadecimal characters (e.g&#x2e;, &quot;13% coverage.html&quot;) will be replaced by &quot;%25&quot;.</li>
<li>Reserved and unreserved characters: An encoded URL should only contain a few characters as literals; all other characters should be percent-encoded. In TolerantMode, these characters will be automatically percent-encoded where they are not allowed: space / double-quote / &quot;&lt;&quot; / &quot;&gt;&quot; / &quot;[&quot; / &quot;&quot; / &quot;]&quot; / &quot;^&quot; / &quot;`&quot; / &quot;{&quot; / &quot;|&quot; / &quot;}&quot;</li>
</ul>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QUrl/QUrl"></a>
<h3 class="fn"><a name="QUrl"></a>QUrl::QUrl ()</h3>
<p>Constructs an empty <a href="qurl.html">QUrl</a> object.</p>
<h3 class="fn"><a name="QUrl-2"></a>QUrl::QUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
<p>Constructs a URL by parsing <i>url</i>. <i>url</i> is assumed to be in human readable representation, with no percent encoding. <a href="qurl.html">QUrl</a> will automatically percent encode all characters that are not allowed in a URL.</p>
<p>Example:</p>
<pre> QUrl url(&quot;http:<span class="comment">//www.example.com/List of holidays.xml&quot;);</span>
<span class="comment"> // url.toEncoded() == &quot;http://www.example.com/List%20of%20holidays.xml&quot;</span></pre>
<p>To construct a URL from an encoded string, call <a href="qurl.html#fromEncoded">fromEncoded</a>():</p>
<pre> QUrl url = QUrl::fromEncoded(&quot;http:<span class="comment">//qt.nokia.com/List%20of%20holidays.xml&quot;);</span></pre>
<p>See also <a href="qurl.html#setUrl">setUrl</a>(), <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>(), <a href="qurl.html#fromEncoded">fromEncoded</a>(), and <a href="qurl.html#ParsingMode-enum">TolerantMode</a>.</p>
<h3 class="fn"><a name="QUrl-3"></a>QUrl::QUrl ( const QUrl &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<h3 class="fn"><a name="QUrl-4"></a>QUrl::QUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )</h3>
<p>This is an overloaded function.</p>
<p>Parses the <i>url</i> using the parser mode <i>parsingMode</i>.</p>
<p>See also <a href="qurl.html#setUrl">setUrl</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/~QUrl"></a>
<h3 class="fn"><a name="dtor.QUrl"></a>QUrl::~QUrl ()</h3>
<p>Destructor; called immediately before the object is deleted.</p>
<a name="//apple_ref/cpp/instm/QUrl/addEncodedQueryItem"></a>
<h3 class="fn"><a name="addEncodedQueryItem"></a>void QUrl::addEncodedQueryItem ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>key</i>, const <a href="qbytearray.html">QByteArray</a> &amp; <i>value</i> )</h3>
<p>Inserts the pair <i>key</i> = <i>value</i> into the query string of the URL.</p>
<p>Note: this function does not verify that either <i>key</i> or <i>value</i> are properly encoded. It is the caller's responsibility to ensure that the query delimiters are properly encoded, if any.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#addQueryItem">addQueryItem</a>() and <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/addQueryItem"></a>
<h3 class="fn"><a name="addQueryItem"></a>void QUrl::addQueryItem ( const <a href="qstring.html">QString</a> &amp; <i>key</i>, const <a href="qstring.html">QString</a> &amp; <i>value</i> )</h3>
<p>Inserts the pair <i>key</i> = <i>value</i> into the query string of the URL.</p>
<p>The key/value pair is encoded before it is added to the query. The pair is converted into separate strings internally. The <i>key</i> and <i>value</i> is first encoded into UTF-8 and then delimited by the character returned by valueDelimiter(). Each key/value pair is delimited by the character returned by pairDelimiter().</p>
<p>See also <a href="qurl.html#addEncodedQueryItem">addEncodedQueryItem</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/allEncodedQueryItemValues"></a>
<h3 class="fn"><a name="allEncodedQueryItemValues"></a><a href="qlist.html">QList</a>&lt;<a href="qbytearray.html">QByteArray</a>&gt; QUrl::allEncodedQueryItemValues ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>key</i> ) const</h3>
<p>Returns the a list of query string values whose key is equal to <i>key</i> from the URL.</p>
<p>Note: if the encoded <i>key</i> does not match the encoded version of the query, this function will not work. That is, if the encoded query of this URL is &quot;search=Qt%20Rules&quot;, calling this function with <i>key</i> = &quot;%73earch&quot; will return an empty list.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#allQueryItemValues">allQueryItemValues</a>(), <a href="qurl.html#queryItemValue">queryItemValue</a>(), and <a href="qurl.html#encodedQueryItemValue">encodedQueryItemValue</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/allQueryItemValues"></a>
<h3 class="fn"><a name="allQueryItemValues"></a><a href="qstringlist.html">QStringList</a> QUrl::allQueryItemValues ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
<p>Returns the a list of query string values whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#queryItemValue">queryItemValue</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/authority"></a>
<h3 class="fn"><a name="authority"></a><a href="qstring.html">QString</a> QUrl::authority () const</h3>
<p>Returns the authority of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/clear"></a>
<h3 class="fn"><a name="clear"></a>void QUrl::clear ()</h3>
<p>Resets the content of the <a href="qurl.html">QUrl</a>. After calling this function, the <a href="qurl.html">QUrl</a> is equal to one that has been constructed with the default empty constructor.</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedFragment"></a>
<h3 class="fn"><a name="encodedFragment"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedFragment () const</h3>
<p>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 <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setEncodedFragment">setEncodedFragment</a>() and <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedHost"></a>
<h3 class="fn"><a name="encodedHost"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedHost () const</h3>
<p>Returns the host part of the URL if it is defined; otherwise an empty string is returned.</p>
<p>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.</p>
<p>This function is equivalent to calling <a href="qurl.html#toAce">QUrl::toAce</a>() on the return value of <a href="qurl.html#host">host</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setEncodedHost">setEncodedHost</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedPassword"></a>
<h3 class="fn"><a name="encodedPassword"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedPassword () const</h3>
<p>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 <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setEncodedPassword">setEncodedPassword</a>() and <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedPath"></a>
<h3 class="fn"><a name="encodedPath"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedPath () const</h3>
<p>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 <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setEncodedPath">setEncodedPath</a>() and <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedQuery"></a>
<h3 class="fn"><a name="encodedQuery"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedQuery () const</h3>
<p>Returns the query string of the URL in percent encoded form.</p>
<p>See also <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedQueryItemValue"></a>
<h3 class="fn"><a name="encodedQueryItemValue"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedQueryItemValue ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>key</i> ) const</h3>
<p>Returns the first query string value whose key is equal to <i>key</i> from the URL.</p>
<p>Note: if the encoded <i>key</i> does not match the encoded version of the query, this function will not work. That is, if the encoded query of this URL is &quot;search=Qt%20Rules&quot;, calling this function with <i>key</i> = &quot;%73earch&quot; will return an empty string.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#queryItemValue">queryItemValue</a>() and <a href="qurl.html#allQueryItemValues">allQueryItemValues</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedQueryItems"></a>
<h3 class="fn"><a name="encodedQueryItems"></a><a href="qlist.html">QList</a>&lt;<a href="qpair.html">QPair</a>&lt;<a href="qbytearray.html">QByteArray</a>, <a href="qbytearray.html">QByteArray</a>&gt; &gt; QUrl::encodedQueryItems () const</h3>
<p>Returns the query string of the URL, as a map of encoded keys and values.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setEncodedQueryItems">setEncodedQueryItems</a>(), <a href="qurl.html#setQueryItems">setQueryItems</a>(), and <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/encodedUserName"></a>
<h3 class="fn"><a name="encodedUserName"></a><a href="qbytearray.html">QByteArray</a> QUrl::encodedUserName () const</h3>
<p>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 <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setEncodedUserName">setEncodedUserName</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/errorString"></a>
<h3 class="fn"><a name="errorString"></a><a href="qstring.html">QString</a> QUrl::errorString () const</h3>
<p>Returns a text string that explains why an URL is invalid in the case being; otherwise returns an empty string.</p>
<p>This function was introduced in Qt 4.2.</p>
<a name="//apple_ref/cpp/instm/QUrl/fragment"></a>
<h3 class="fn"><a name="fragment"></a><a href="qstring.html">QString</a> QUrl::fragment () const</h3>
<p>Returns the fragment of the URL.</p>
<p>See also <a href="qurl.html#setFragment">setFragment</a>().</p>
<a name="//apple_ref/cpp/clm/QUrl/fromAce"></a>
<h3 class="fn"><a name="fromAce"></a><a href="qstring.html">QString</a> QUrl::fromAce ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>domain</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the Unicode form of the given domain name <i>domain</i>, which is encoded in the ASCII Compatible Encoding (ACE). The result of this function is considered equivalent to <i>domain</i>.</p>
<p>If the value in <i>domain</i> cannot be encoded, it will be converted to <a href="qstring.html">QString</a> and returned.</p>
<p>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 <tt>&quot;example.com&quot;</tt>) to be written using international characters.</p>
<p>This function was introduced in Qt 4.2.</p>
<a name="//apple_ref/cpp/clm/QUrl/fromEncoded"></a>
<h3 class="fn"><a name="fromEncoded"></a>QUrl QUrl::fromEncoded ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>input</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Parses <i>input</i> and returns the corresponding <a href="qurl.html">QUrl</a>. <i>input</i> is assumed to be in encoded form, containing only ASCII characters.</p>
<p>The URL is parsed using <a href="qurl.html#ParsingMode-enum">TolerantMode</a>.</p>
<p>See also <a href="qurl.html#toEncoded">toEncoded</a>() and <a href="qurl.html#setUrl">setUrl</a>().</p>
<h3 class="fn"><a name="fromEncoded-2"></a>QUrl QUrl::fromEncoded ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>input</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>This is an overloaded function.</p>
<p>Parses the URL using <i>parsingMode</i>.</p>
<p>See also <a href="qurl.html#toEncoded">toEncoded</a>() and <a href="qurl.html#setUrl">setUrl</a>().</p>
<a name="//apple_ref/cpp/clm/QUrl/fromLocalFile"></a>
<h3 class="fn"><a name="fromLocalFile"></a>QUrl QUrl::fromLocalFile ( const <a href="qstring.html">QString</a> &amp; <i>localFile</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns a <a href="qurl.html">QUrl</a> representation of <i>localFile</i>, interpreted as a local file.</p>
<p>See also <a href="qurl.html#toLocalFile">toLocalFile</a>().</p>
<a name="//apple_ref/cpp/clm/QUrl/fromPercentEncoding"></a>
<h3 class="fn"><a name="fromPercentEncoding"></a><a href="qstring.html">QString</a> QUrl::fromPercentEncoding ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>input</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns a decoded copy of <i>input</i>. <i>input</i> is first decoded from percent encoding, then converted from UTF-8 to unicode.</p>
<a name="//apple_ref/cpp/clm/QUrl/fromUserInput"></a>
<h3 class="fn"><a name="fromUserInput"></a>QUrl QUrl::fromUserInput ( const <a href="qstring.html">QString</a> &amp; <i>userInput</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns a valid URL from a user supplied <i>userInput</i> string if one can be deducted. In the case that is not possible, an invalid <a href="qurl.html#QUrl">QUrl</a>() is returned.</p>
<p>Most applications that can browse the web, allow the user to input a URL in the form of a plain string. This string can be manually typed into a location bar, obtained from the clipboard, or passed in via command line arguments.</p>
<p>When the string is not already a valid URL, a best guess is performed, making various web related assumptions.</p>
<p>In the case the string corresponds to a valid file path on the system, a file:// URL is constructed, using <a href="qurl.html#fromLocalFile">QUrl::fromLocalFile</a>().</p>
<p>If that is not the case, an attempt is made to turn the string into a http:// or ftp:// URL. The latter in the case the string starts with 'ftp'. The result is then passed through <a href="qurl.html">QUrl</a>'s tolerant parser, and in the case or success, a valid <a href="qurl.html">QUrl</a> is returned, or else a <a href="qurl.html#QUrl">QUrl</a>().</p>
<a name="examples"></a>
<h4>Examples:</h4>
<ul>
<li>qt.nokia.com becomes http://qt.nokia.com</li>
<li>ftp.qt.nokia.com becomes ftp://ftp.qt.nokia.com</li>
<li>hostname becomes http://hostname</li>
<li>/home/user/test.html becomes file:///home/user/test.html</li>
</ul>
<a name="tips-to-avoid-erroneous-character-conversion-when-dealing-with"></a>
<h5>Tips to avoid erroneous character conversion when dealing with</h5>
<p>URLs and strings:</p>
<ul>
<li>When creating an URL <a href="qstring.html">QString</a> from a <a href="qbytearray.html">QByteArray</a> or a char*, always use <a href="qstring.html#fromUtf8">QString::fromUtf8</a>().</li>
<li>Favor the use of <a href="qurl.html#fromEncoded">QUrl::fromEncoded</a>() and <a href="qurl.html#toEncoded">QUrl::toEncoded</a>() instead of <a href="qurl.html">QUrl</a>(string) and <a href="qurl.html#toString">QUrl::toString</a>() when converting <a href="qurl.html">QUrl</a> to/from string.</li>
</ul>
<p>This function was introduced in Qt 4.6.</p>
<a name="//apple_ref/cpp/instm/QUrl/hasEncodedQueryItem"></a>
<h3 class="fn"><a name="hasEncodedQueryItem"></a>bool QUrl::hasEncodedQueryItem ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>key</i> ) const</h3>
<p>Returns true if there is a query string pair whose key is equal to <i>key</i> from the URL.</p>
<p>Note: if the encoded <i>key</i> does not match the encoded version of the query, this function will return false. That is, if the encoded query of this URL is &quot;search=Qt%20Rules&quot;, calling this function with <i>key</i> = &quot;%73earch&quot; will return false.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#hasQueryItem">hasQueryItem</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/hasFragment"></a>
<h3 class="fn"><a name="hasFragment"></a>bool QUrl::hasFragment () const</h3>
<p>Returns true if this URL contains a fragment (i.e&#x2e;, if # was seen on it).</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#fragment">fragment</a>() and <a href="qurl.html#setFragment">setFragment</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/hasQuery"></a>
<h3 class="fn"><a name="hasQuery"></a>bool QUrl::hasQuery () const</h3>
<p>Returns true if this URL contains a Query (i.e&#x2e;, if ? was seen on it).</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#hasQueryItem">hasQueryItem</a>() and <a href="qurl.html#encodedQuery">encodedQuery</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/hasQueryItem"></a>
<h3 class="fn"><a name="hasQueryItem"></a>bool QUrl::hasQueryItem ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
<p>Returns true if there is a query string pair whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#hasEncodedQueryItem">hasEncodedQueryItem</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/host"></a>
<h3 class="fn"><a name="host"></a><a href="qstring.html">QString</a> QUrl::host () const</h3>
<p>Returns the host of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setHost">setHost</a>().</p>
<a name="//apple_ref/cpp/clm/QUrl/idnWhitelist"></a>
<h3 class="fn"><a name="idnWhitelist"></a><a href="qstringlist.html">QStringList</a> QUrl::idnWhitelist ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the current whitelist of top-level domains that are allowed to have non-ASCII characters in their compositions.</p>
<p>See <a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a>() for the rationale of this list.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/isEmpty"></a>
<h3 class="fn"><a name="isEmpty"></a>bool QUrl::isEmpty () const</h3>
<p>Returns true if the URL has no data; otherwise returns false.</p>
<a name="//apple_ref/cpp/instm/QUrl/isParentOf"></a>
<h3 class="fn"><a name="isParentOf"></a>bool QUrl::isParentOf ( const QUrl &amp; <i>childUrl</i> ) const</h3>
<p>Returns true if this URL is a parent of <i>childUrl</i>. <i>childUrl</i> is a child of this URL if the two URLs share the same scheme and authority, and this URL's path is a parent of the path of <i>childUrl</i>.</p>
<a name="//apple_ref/cpp/instm/QUrl/isRelative"></a>
<h3 class="fn"><a name="isRelative"></a>bool QUrl::isRelative () const</h3>
<p>Returns true if the URL is relative; otherwise returns false. A URL is relative if its scheme is undefined; this function is therefore equivalent to calling <a href="qurl.html#scheme">scheme</a>().<a href="qurl.html#isEmpty">isEmpty</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/isValid"></a>
<h3 class="fn"><a name="isValid"></a>bool QUrl::isValid () const</h3>
<p>Returns true if the URL is valid; otherwise returns false.</p>
<p>The URL is run through a conformance test. Every part of the URL must conform to the standard encoding rules of the URI standard for the URL to be reported as valid.</p>
<pre> bool checkUrl(const QUrl &amp;url) {
     if (!url.isValid()) {
         qDebug(QString(&quot;Invalid URL: %1&quot;).arg(url.toString()));
         return false;
     }

     return true;
 }</pre>
<a name="//apple_ref/cpp/instm/QUrl/password"></a>
<h3 class="fn"><a name="password"></a><a href="qstring.html">QString</a> QUrl::password () const</h3>
<p>Returns the password of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setPassword">setPassword</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/path"></a>
<h3 class="fn"><a name="path"></a><a href="qstring.html">QString</a> QUrl::path () const</h3>
<p>Returns the path of the URL.</p>
<p>See also <a href="qurl.html#setPath">setPath</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/port"></a>
<h3 class="fn"><a name="port"></a>int QUrl::port () const</h3>
<p>Returns the port of the URL, or -1 if the port is unspecified.</p>
<p>See also <a href="qurl.html#setPort">setPort</a>().</p>
<h3 class="fn"><a name="port-2"></a>int QUrl::port ( int <i>defaultPort</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns the port of the URL, or <i>defaultPort</i> if the port is unspecified.</p>
<p>Example:</p>
<pre> QFtp ftp;
 ftp.connectToHost(url.host(), url.port(21));</pre>
<p>This function was introduced in Qt 4.1.</p>
<a name="//apple_ref/cpp/instm/QUrl/queryItemValue"></a>
<h3 class="fn"><a name="queryItemValue"></a><a href="qstring.html">QString</a> QUrl::queryItemValue ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
<p>Returns the first query string value whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#allQueryItemValues">allQueryItemValues</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/queryItems"></a>
<h3 class="fn"><a name="queryItems"></a><a href="qlist.html">QList</a>&lt;<a href="qpair.html">QPair</a>&lt;<a href="qstring.html">QString</a>, <a href="qstring.html">QString</a>&gt; &gt; QUrl::queryItems () const</h3>
<p>Returns the query string of the URL, as a map of keys and values.</p>
<p>See also <a href="qurl.html#setQueryItems">setQueryItems</a>() and <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/queryPairDelimiter"></a>
<h3 class="fn"><a name="queryPairDelimiter"></a>char QUrl::queryPairDelimiter () const</h3>
<p>Returns the character used to delimit between key-value pairs in the query string of the URL.</p>
<a name="//apple_ref/cpp/instm/QUrl/queryValueDelimiter"></a>
<h3 class="fn"><a name="queryValueDelimiter"></a>char QUrl::queryValueDelimiter () const</h3>
<p>Returns the character used to delimit between keys and values in the query string of the URL.</p>
<a name="//apple_ref/cpp/instm/QUrl/removeAllEncodedQueryItems"></a>
<h3 class="fn"><a name="removeAllEncodedQueryItems"></a>void QUrl::removeAllEncodedQueryItems ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>key</i> )</h3>
<p>Removes all the query string pairs whose key is equal to <i>key</i> from the URL.</p>
<p>Note: if the encoded <i>key</i> does not match the encoded version of the query, this function will not work. That is, if the encoded query of this URL is &quot;search=Qt%20Rules&quot;, calling this function with <i>key</i> = &quot;%73earch&quot; will do nothing.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#removeQueryItem">removeQueryItem</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/removeAllQueryItems"></a>
<h3 class="fn"><a name="removeAllQueryItems"></a>void QUrl::removeAllQueryItems ( const <a href="qstring.html">QString</a> &amp; <i>key</i> )</h3>
<p>Removes all the query string pairs whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#removeQueryItem">removeQueryItem</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/removeEncodedQueryItem"></a>
<h3 class="fn"><a name="removeEncodedQueryItem"></a>void QUrl::removeEncodedQueryItem ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>key</i> )</h3>
<p>Removes the first query string pair whose key is equal to <i>key</i> from the URL.</p>
<p>Note: if the encoded <i>key</i> does not match the encoded version of the query, this function will not work. That is, if the encoded query of this URL is &quot;search=Qt%20Rules&quot;, calling this function with <i>key</i> = &quot;%73earch&quot; will do nothing.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#removeQueryItem">removeQueryItem</a>() and <a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/removeQueryItem"></a>
<h3 class="fn"><a name="removeQueryItem"></a>void QUrl::removeQueryItem ( const <a href="qstring.html">QString</a> &amp; <i>key</i> )</h3>
<p>Removes the first query string pair whose key is equal to <i>key</i> from the URL.</p>
<p>See also <a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/resolved"></a>
<h3 class="fn"><a name="resolved"></a>QUrl QUrl::resolved ( const QUrl &amp; <i>relative</i> ) const</h3>
<p>Returns the result of the merge of this URL with <i>relative</i>. This URL is used as a base to convert <i>relative</i> to an absolute URL.</p>
<p>If <i>relative</i> is not a relative URL, this function will return <i>relative</i> directly. Otherwise, the paths of the two URLs are merged, and the new URL returned has the scheme and authority of the base URL, but with the merged path, as in the following example:</p>
<pre> QUrl baseUrl(&quot;http:<span class="comment">//qt.nokia.com/support&quot;);</span>
 QUrl relativeUrl(&quot;../products/solutions&quot;);
 qDebug(baseUrl.resolved(relativeUrl).toString());
<span class="comment"> // prints &quot;http://qt.nokia.com/products/solutions&quot;</span></pre>
<p>Calling resolved() with &quot;..&quot; returns a <a href="qurl.html">QUrl</a> whose directory is one level higher than the original. Similarly, calling resolved() with &quot;../&#x2e;.&quot; removes two levels from the path. If <i>relative</i> is &quot;/&quot;, the path becomes &quot;/&quot;.</p>
<p>See also <a href="qurl.html#isRelative">isRelative</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/scheme"></a>
<h3 class="fn"><a name="scheme"></a><a href="qstring.html">QString</a> QUrl::scheme () const</h3>
<p>Returns the scheme of the URL. If an empty string is returned, this means the scheme is undefined and the URL is then relative.</p>
<p>See also <a href="qurl.html#setScheme">setScheme</a>() and <a href="qurl.html#isRelative">isRelative</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setAuthority"></a>
<h3 class="fn"><a name="setAuthority"></a>void QUrl::setAuthority ( const <a href="qstring.html">QString</a> &amp; <i>authority</i> )</h3>
<p>Sets the authority of the URL to <i>authority</i>.</p>
<p>The authority of a URL is the combination of user info, a host name and a port. All of these elements are optional; an empty authority is therefore valid.</p>
<p>The user info and host are separated by a '<a href="examples-overview.html">@</a>', and the host and port are separated by a ':'. If the user info is empty, the '<a href="examples-overview.html">@</a>' must be omitted; although a stray ':' is permitted if the port is empty.</p>
<p>The following example shows a valid authority string:</p>
<p align="center"><img src="images/qurl-authority.png" /></p><p>See also <a href="qurl.html#authority">authority</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedFragment"></a>
<h3 class="fn"><a name="setEncodedFragment"></a>void QUrl::setEncodedFragment ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>fragment</i> )</h3>
<p>Sets the URL's fragment to the percent-encoded <i>fragment</i>. 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:</p>
<p align="center"><img src="images/qurl-fragment.png" /></p><p>The fragment is sometimes also referred to as the URL &quot;reference&quot;.</p>
<p>Passing an argument of QByteArray() (a null <a href="qbytearray.html">QByteArray</a>) will unset the fragment. Passing an argument of <a href="qbytearray.html">QByteArray</a>(&quot;&quot;) (an empty but not null <a href="qbytearray.html">QByteArray</a>) will set the fragment to an empty string (as if the original URL had a lone &quot;#&quot;).</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setFragment">setFragment</a>() and <a href="qurl.html#encodedFragment">encodedFragment</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedHost"></a>
<h3 class="fn"><a name="setEncodedHost"></a>void QUrl::setEncodedHost ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>host</i> )</h3>
<p>Sets the URL's host to the ACE- or percent-encoded <i>host</i>. The <i>host</i> is part of the user info element in the authority of the URL, as described in <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setHost">setHost</a>(), <a href="qurl.html#encodedHost">encodedHost</a>(), <a href="qurl.html#setAuthority">setAuthority</a>(), and <a href="qurl.html#fromAce">fromAce</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedPassword"></a>
<h3 class="fn"><a name="setEncodedPassword"></a>void QUrl::setEncodedPassword ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>password</i> )</h3>
<p>Sets the URL's password to the percent-encoded <i>password</i>. The <i>password</i> is part of the user info element in the authority of the URL, as described in <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<p>Note: this function does not verify that <i>password</i> is properly encoded. It is the caller's responsibility to ensure that the any delimiters (such as colons or slashes) are properly encoded.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setPassword">setPassword</a>(), <a href="qurl.html#encodedPassword">encodedPassword</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedPath"></a>
<h3 class="fn"><a name="setEncodedPath"></a>void QUrl::setEncodedPath ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>path</i> )</h3>
<p>Sets the URL's path to the percent-encoded <i>path</i>. The path is the part of the URL that comes after the authority but before the query string.</p>
<p align="center"><img src="images/qurl-ftppath.png" /></p><p>For non-hierarchical schemes, the path will be everything following the scheme declaration, as in the following example:</p>
<p align="center"><img src="images/qurl-mailtopath.png" /></p><p>Note: this function does not verify that <i>path</i> is properly encoded. It is the caller's responsibility to ensure that the any delimiters (such as '?' and '#') are properly encoded.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setPath">setPath</a>(), <a href="qurl.html#encodedPath">encodedPath</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedQuery"></a>
<h3 class="fn"><a name="setEncodedQuery"></a>void QUrl::setEncodedQuery ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>query</i> )</h3>
<p>Sets the query string of the URL to <i>query</i>. The string is inserted as-is, and no further encoding is performed when calling <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<p>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 <a href="qurl.html">QUrl</a>.</p>
<p>Passing a value of QByteArray() to <i>query</i> (a null <a href="qbytearray.html">QByteArray</a>) unsets the query completely. However, passing a value of <a href="qbytearray.html">QByteArray</a>(&quot;&quot;) will set the query to an empty value, as if the original URL had a lone &quot;?&quot;.</p>
<p>See also <a href="qurl.html#encodedQuery">encodedQuery</a>() and <a href="qurl.html#hasQuery">hasQuery</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedQueryItems"></a>
<h3 class="fn"><a name="setEncodedQueryItems"></a>void QUrl::setEncodedQueryItems ( const <a href="qlist.html">QList</a>&lt;<a href="qpair.html">QPair</a>&lt;<a href="qbytearray.html">QByteArray</a>, <a href="qbytearray.html">QByteArray</a>&gt; &gt; &amp; <i>query</i> )</h3>
<p>Sets the query string of the URL to the encoded version of <i>query</i>. The contents of <i>query</i> are converted to a string internally, each pair delimited by the character returned by pairDelimiter(), and the key and value are delimited by valueDelimiter().</p>
<p>Note: this function does not verify that the key-value pairs are properly encoded. It is the caller's responsibility to ensure that the query delimiters are properly encoded, if any.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>(), <a href="qurl.html#encodedQueryItems">encodedQueryItems</a>(), and <a href="qurl.html#setQueryItems">setQueryItems</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedUrl"></a>
<h3 class="fn"><a name="setEncodedUrl"></a>void QUrl::setEncodedUrl ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>encodedUrl</i> )</h3>
<p>Constructs a URL by parsing the contents of <i>encodedUrl</i>.</p>
<p><i>encodedUrl</i> is assumed to be a URL string in percent encoded form, containing only ASCII characters.</p>
<p>Use <a href="qurl.html#isValid">isValid</a>() to determine if a valid URL was constructed.</p>
<p>See also <a href="qurl.html#setUrl">setUrl</a>().</p>
<h3 class="fn"><a name="setEncodedUrl-2"></a>void QUrl::setEncodedUrl ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>encodedUrl</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )</h3>
<p>Constructs a URL by parsing the contents of <i>encodedUrl</i> using the given <i>parsingMode</i>.</p>
<a name="//apple_ref/cpp/instm/QUrl/setEncodedUserName"></a>
<h3 class="fn"><a name="setEncodedUserName"></a>void QUrl::setEncodedUserName ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>userName</i> )</h3>
<p>Sets the URL's user name to the percent-encoded <i>userName</i>. The <i>userName</i> is part of the user info element in the authority of the URL, as described in <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<p>Note: this function does not verify that <i>userName</i> is properly encoded. It is the caller's responsibility to ensure that the any delimiters (such as colons or slashes) are properly encoded.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qurl.html#setUserName">setUserName</a>(), <a href="qurl.html#encodedUserName">encodedUserName</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setFragment"></a>
<h3 class="fn"><a name="setFragment"></a>void QUrl::setFragment ( const <a href="qstring.html">QString</a> &amp; <i>fragment</i> )</h3>
<p>Sets the fragment of the URL to <i>fragment</i>. 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:</p>
<p align="center"><img src="images/qurl-fragment.png" /></p><p>The fragment is sometimes also referred to as the URL &quot;reference&quot;.</p>
<p>Passing an argument of QString() (a null <a href="qstring.html">QString</a>) will unset the fragment. Passing an argument of <a href="qstring.html">QString</a>(&quot;&quot;) (an empty but not null <a href="qstring.html">QString</a>) will set the fragment to an empty string (as if the original URL had a lone &quot;#&quot;).</p>
<p>See also <a href="qurl.html#fragment">fragment</a>() and <a href="qurl.html#hasFragment">hasFragment</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setHost"></a>
<h3 class="fn"><a name="setHost"></a>void QUrl::setHost ( const <a href="qstring.html">QString</a> &amp; <i>host</i> )</h3>
<p>Sets the host of the URL to <i>host</i>. The host is part of the authority.</p>
<p>See also <a href="qurl.html#host">host</a>() and <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<a name="//apple_ref/cpp/clm/QUrl/setIdnWhitelist"></a>
<h3 class="fn"><a name="setIdnWhitelist"></a>void QUrl::setIdnWhitelist ( const <a href="qstringlist.html">QStringList</a> &amp; <i>list</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Sets the whitelist of Top-Level Domains (TLDs) that are allowed to have non-ASCII characters in domains to the value of <i>list</i>.</p>
<p>Qt has comes a default list that contains the Internet top-level domains that have published support for Internationalized Domain Names (IDNs) and rules to guarantee that no deception can happen between similarly-looking characters (such as the Latin lowercase letter <tt>'a'</tt> and the Cyrillic equivalent, which in most fonts are visually identical).</p>
<p>This list is periodically maintained, as registrars publish new rules.</p>
<p>This function is provided for those who need to manipulate the list, in order to add or remove a TLD. It is not recommended to change its value for purposes other than testing, as it may expose users to security risks.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qurl.html#idnWhitelist">idnWhitelist</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setPassword"></a>
<h3 class="fn"><a name="setPassword"></a>void QUrl::setPassword ( const <a href="qstring.html">QString</a> &amp; <i>password</i> )</h3>
<p>Sets the URL's password to <i>password</i>. The <i>password</i> is part of the user info element in the authority of the URL, as described in <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<p>See also <a href="qurl.html#password">password</a>() and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setPath"></a>
<h3 class="fn"><a name="setPath"></a>void QUrl::setPath ( const <a href="qstring.html">QString</a> &amp; <i>path</i> )</h3>
<p>Sets the path of the URL to <i>path</i>. The path is the part of the URL that comes after the authority but before the query string.</p>
<p align="center"><img src="images/qurl-ftppath.png" /></p><p>For non-hierarchical schemes, the path will be everything following the scheme declaration, as in the following example:</p>
<p align="center"><img src="images/qurl-mailtopath.png" /></p><p>See also <a href="qurl.html#path">path</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setPort"></a>
<h3 class="fn"><a name="setPort"></a>void QUrl::setPort ( int <i>port</i> )</h3>
<p>Sets the port of the URL to <i>port</i>. The port is part of the authority of the URL, as described in <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<p><i>port</i> must be between 0 and 65535 inclusive. Setting the port to -1 indicates that the port is unspecified.</p>
<p>See also <a href="qurl.html#port">port</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setQueryDelimiters"></a>
<h3 class="fn"><a name="setQueryDelimiters"></a>void QUrl::setQueryDelimiters ( char <i>valueDelimiter</i>, char <i>pairDelimiter</i> )</h3>
<p>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 '&amp;'.</p>
<p align="center"><img src="images/qurl-querystring.png" /></p><p><i>valueDelimiter</i> will be used for separating keys from values, and <i>pairDelimiter</i> 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.</p>
<p>If <i>valueDelimiter</i> is set to '-' and <i>pairDelimiter</i> is '/', the above query string would instead be represented like this:</p>
<pre> http:<span class="comment">//www.example.com/cgi-bin/drawgraph.cgi?type-pie/color-green</span></pre>
<p>Calling this function does not change the delimiters of the current query string. It only affects <a href="qurl.html#queryItems">queryItems</a>(), <a href="qurl.html#setQueryItems">setQueryItems</a>() and addQueryItems().</p>
<a name="//apple_ref/cpp/instm/QUrl/setQueryItems"></a>
<h3 class="fn"><a name="setQueryItems"></a>void QUrl::setQueryItems ( const <a href="qlist.html">QList</a>&lt;<a href="qpair.html">QPair</a>&lt;<a href="qstring.html">QString</a>, <a href="qstring.html">QString</a>&gt; &gt; &amp; <i>query</i> )</h3>
<p>Sets the query string of the URL to an encoded version of <i>query</i>. The contents of <i>query</i> are converted to a string internally, each pair delimited by the character returned by pairDelimiter(), and the key and value are delimited by valueDelimiter().</p>
<p>See also <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>(), <a href="qurl.html#queryItems">queryItems</a>(), and <a href="qurl.html#setEncodedQueryItems">setEncodedQueryItems</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setScheme"></a>
<h3 class="fn"><a name="setScheme"></a>void QUrl::setScheme ( const <a href="qstring.html">QString</a> &amp; <i>scheme</i> )</h3>
<p>Sets the scheme of the URL to <i>scheme</i>. As a scheme can only contain ASCII characters, no conversion or encoding is done on the input.</p>
<p>The scheme describes the type (or protocol) of the URL. It's represented by one or more ASCII characters at the start the URL, and is followed by a ':'. The following example shows a URL where the scheme is &quot;ftp&quot;:</p>
<p align="center"><img src="images/qurl-authority2.png" /></p><p>The scheme can also be empty, in which case the URL is interpreted as relative.</p>
<p>See also <a href="qurl.html#scheme">scheme</a>() and <a href="qurl.html#isRelative">isRelative</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setUrl"></a>
<h3 class="fn"><a name="setUrl"></a>void QUrl::setUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
<p>Constructs a URL by parsing the contents of <i>url</i>.</p>
<p><i>url</i> is assumed to be in unicode format, with no percent encoding.</p>
<p>Calling <a href="qurl.html#isValid">isValid</a>() will tell whether or not a valid URL was constructed.</p>
<p>See also <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>().</p>
<h3 class="fn"><a name="setUrl-2"></a>void QUrl::setUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a> <i>parsingMode</i> )</h3>
<p>This is an overloaded function.</p>
<p>Parses <i>url</i> using the parsing mode <i>parsingMode</i>.</p>
<p>See also <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setUserInfo"></a>
<h3 class="fn"><a name="setUserInfo"></a>void QUrl::setUserInfo ( const <a href="qstring.html">QString</a> &amp; <i>userInfo</i> )</h3>
<p>Sets the user info of the URL to <i>userInfo</i>. The user info is an optional part of the authority of the URL, as described in <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<p>The user info consists of a user name and optionally a password, separated by a ':'. If the password is empty, the colon must be omitted. The following example shows a valid user info string:</p>
<p align="center"><img src="images/qurl-authority3.png" /></p><p>See also <a href="qurl.html#userInfo">userInfo</a>(), <a href="qurl.html#setUserName">setUserName</a>(), <a href="qurl.html#setPassword">setPassword</a>(), and <a href="qurl.html#setAuthority">setAuthority</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/setUserName"></a>
<h3 class="fn"><a name="setUserName"></a>void QUrl::setUserName ( const <a href="qstring.html">QString</a> &amp; <i>userName</i> )</h3>
<p>Sets the URL's user name to <i>userName</i>. The <i>userName</i> is part of the user info element in the authority of the URL, as described in <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<p>See also <a href="qurl.html#setEncodedUserName">setEncodedUserName</a>(), <a href="qurl.html#userName">userName</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<a name="//apple_ref/cpp/clm/QUrl/toAce"></a>
<h3 class="fn"><a name="toAce"></a><a href="qbytearray.html">QByteArray</a> QUrl::toAce ( const <a href="qstring.html">QString</a> &amp; <i>domain</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the ASCII Compatible Encoding of the given domain name <i>domain</i>. The result of this function is considered equivalent to <i>domain</i>.</p>
<p>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 <tt>&quot;example.com&quot;</tt>) to be written using international characters.</p>
<p>This function return an empty QByteArra if <i>domain</i> is not a valid hostname. Note, in particular, that IPv6 literals are not valid domain names.</p>
<p>This function was introduced in Qt 4.2.</p>
<a name="//apple_ref/cpp/instm/QUrl/toEncoded"></a>
<h3 class="fn"><a name="toEncoded"></a><a href="qbytearray.html">QByteArray</a> QUrl::toEncoded ( <a href="qurl.html#FormattingOption-enum">FormattingOptions</a> <i>options</i> = None ) const</h3>
<p>Returns the encoded representation of the URL if it's valid; otherwise an empty <a href="qbytearray.html">QByteArray</a> is returned. The output can be customized by passing flags with <i>options</i>.</p>
<p>The user info, path and fragment are all converted to UTF-8, and all non-ASCII characters are then percent encoded. The host name is encoded using Punycode.</p>
<a name="//apple_ref/cpp/instm/QUrl/toLocalFile"></a>
<h3 class="fn"><a name="toLocalFile"></a><a href="qstring.html">QString</a> QUrl::toLocalFile () const</h3>
<p>Returns the path of this URL formatted as a local file path.</p>
<p>See also <a href="qurl.html#fromLocalFile">fromLocalFile</a>().</p>
<a name="//apple_ref/cpp/clm/QUrl/toPercentEncoding"></a>
<h3 class="fn"><a name="toPercentEncoding"></a><a href="qbytearray.html">QByteArray</a> QUrl::toPercentEncoding ( const <a href="qstring.html">QString</a> &amp; <i>input</i>, const <a href="qbytearray.html">QByteArray</a> &amp; <i>exclude</i> = QByteArray(), const <a href="qbytearray.html">QByteArray</a> &amp; <i>include</i> = QByteArray() )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns an encoded copy of <i>input</i>. <i>input</i> is first converted to UTF-8, and all ASCII-characters that are not in the unreserved group are percent encoded. To prevent characters from being percent encoded pass them to <i>exclude</i>. To force characters to be percent encoded pass them to <i>include</i>.</p>
<p>Unreserved is defined as: ALPHA / DIGIT / &quot;-&quot; / &quot;.&quot; / &quot;<a href="examples-overview.html">_</a>&quot; / &quot;~&quot;</p>
<pre> QByteArray ba = QUrl::toPercentEncoding(&quot;{a fishy string?}&quot;, &quot;{}&quot;, &quot;s&quot;);
 qDebug(ba.constData());
<span class="comment"> // prints &quot;{a fi%73hy %73tring%3F}&quot;</span></pre>
<a name="//apple_ref/cpp/instm/QUrl/toString"></a>
<h3 class="fn"><a name="toString"></a><a href="qstring.html">QString</a> QUrl::toString ( <a href="qurl.html#FormattingOption-enum">FormattingOptions</a> <i>options</i> = None ) const</h3>
<p>Returns the human-displayable string representation of the URL. The output can be customized by passing flags with <i>options</i>.</p>
<p>See also <a href="qurl.html#FormattingOption-enum">FormattingOptions</a> and <a href="qurl.html#toEncoded">toEncoded</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/userInfo"></a>
<h3 class="fn"><a name="userInfo"></a><a href="qstring.html">QString</a> QUrl::userInfo () const</h3>
<p>Returns the user info of the URL, or an empty string if the user info is undefined.</p>
<p>See also <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/userName"></a>
<h3 class="fn"><a name="userName"></a><a href="qstring.html">QString</a> QUrl::userName () const</h3>
<p>Returns the user name of the URL if it is defined; otherwise an empty string is returned.</p>
<p>See also <a href="qurl.html#setUserName">setUserName</a>() and <a href="qurl.html#encodedUserName">encodedUserName</a>().</p>
<a name="//apple_ref/cpp/instm/QUrl/operator!="></a>
<h3 class="fn"><a name="operator-not-eq"></a>bool QUrl::operator!= ( const QUrl &amp; <i>url</i> ) const</h3>
<p>Returns true if this URL and the given <i>url</i> are not equal; otherwise returns false.</p>
<a name="//apple_ref/cpp/instm/QUrl/operator="></a>
<h3 class="fn"><a name="operator-eq"></a>QUrl &amp; QUrl::operator= ( const QUrl &amp; <i>url</i> )</h3>
<p>Assigns the specified <i>url</i> to this object.</p>
<h3 class="fn"><a name="operator-eq-2"></a>QUrl &amp; QUrl::operator= ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
<p>Assigns the specified <i>url</i> to this object.</p>
<a name="//apple_ref/cpp/instm/QUrl/operator=="></a>
<h3 class="fn"><a name="operator-eq-eq"></a>bool QUrl::operator== ( const QUrl &amp; <i>url</i> ) const</h3>
<p>Returns true if this URL and the given <i>url</i> are equal; otherwise returns false.</p>
<hr />
<h2>Related Non-Members</h2>
<h3 class="fn"><a name="operator-lt-lt-192"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>out</i>, const QUrl &amp; <i>url</i> )</h3>
<p>Writes url <i>url</i> to the stream <i>out</i> and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
<h3 class="fn"><a name="operator-gt-gt-108"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>in</i>, QUrl &amp; <i>url</i> )</h3>
<p>Reads a url into <i>url</i> from the stream <i>in</i> and returns a reference to the stream.</p>
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
<hr />
<h2>Macro Documentation</h2>
<a name="//apple_ref/cpp/macro//QT_NO_URL_CAST_FROM_STRING"></a>
<h3 class="fn"><a name="QT_NO_URL_CAST_FROM_STRING"></a>QT_NO_URL_CAST_FROM_STRING</h3>
<p>Disables automatic conversions from <a href="qstring.html">QString</a> (or char *) to <a href="qurl.html">QUrl</a>.</p>
<p>Compiling your code with this define is useful when you have a lot of code that uses <a href="qstring.html">QString</a> for file names and you wish to convert it to use <a href="qurl.html">QUrl</a> for network transparency. In any code that uses <a href="qurl.html">QUrl</a>, it can help avoid missing <a href="qurl.html#resolved">QUrl::resolved</a>() calls, and other misuses of <a href="qstring.html">QString</a> to <a href="qurl.html">QUrl</a> conversions.</p>
<p>For example, if you have code like</p>
<pre><font color="#404040"> url = filename; // probably not what you want</font></pre>
<p>you can rewrite it as</p>
<pre> url = QUrl::fromLocalFile(filename);
 url = baseurl.resolved(QUrl(filename));</pre>
<p>See also <a href="qstring.html#QT_NO_CAST_FROM_ASCII">QT_NO_CAST_FROM_ASCII</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>