File: qurl.html

package info (click to toggle)
python-qt4 4.11.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 39,748 kB
  • ctags: 6,146
  • sloc: python: 125,938; cpp: 12,612; xml: 292; makefile: 258; php: 27; sh: 27
file content (930 lines) | stat: -rw-r--r-- 69,856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QUrl Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QUrl Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QUrl class provides a convenient interface for working with
URLs. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qurl.html#FormattingOption-enum">FormattingOption</a></b> { None, RemoveScheme, RemovePassword, RemoveUserInfo, ..., StripTrailingSlash }</li><li><div class="fn" />class <b><a href="qurl-formattingoptions.html">FormattingOptions</a></b></li><li><div class="fn" />enum <b><a href="qurl.html#ParsingMode-enum">ParsingMode</a></b> { TolerantMode, StrictMode }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qurl.html#QUrl">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qurl.html#QUrl-2">__init__</a></b> (<i>self</i>, QString&#160;<i>url</i>)</li><li><div class="fn" /><b><a href="qurl.html#QUrl-3">__init__</a></b> (<i>self</i>, QString&#160;<i>url</i>, ParsingMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qurl.html#QUrl-4">__init__</a></b> (<i>self</i>, QUrl&#160;<i>copy</i>)</li><li><div class="fn" /><b><a href="qurl.html#addEncodedQueryItem">addEncodedQueryItem</a></b> (<i>self</i>, QByteArray&#160;<i>key</i>, QByteArray&#160;<i>value</i>)</li><li><div class="fn" /><b><a href="qurl.html#addQueryItem">addQueryItem</a></b> (<i>self</i>, QString&#160;<i>key</i>, QString&#160;<i>value</i>)</li><li><div class="fn" />list-of-QByteArray <b><a href="qurl.html#allEncodedQueryItemValues">allEncodedQueryItemValues</a></b> (<i>self</i>, QByteArray&#160;<i>key</i>)</li><li><div class="fn" />QStringList <b><a href="qurl.html#allQueryItemValues">allQueryItemValues</a></b> (<i>self</i>, QString&#160;<i>key</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#authority">authority</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qurl.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qurl.html#detach">detach</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#encodedFragment">encodedFragment</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#encodedHost">encodedHost</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#encodedPassword">encodedPassword</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#encodedPath">encodedPath</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#encodedQuery">encodedQuery</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-tuple-of-QByteArray-QByteArray <b><a href="qurl.html#encodedQueryItems">encodedQueryItems</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#encodedQueryItemValue">encodedQueryItemValue</a></b> (<i>self</i>, QByteArray&#160;<i>key</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#encodedUserName">encodedUserName</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#errorString">errorString</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#fragment">fragment</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#hasEncodedQueryItem">hasEncodedQueryItem</a></b> (<i>self</i>, QByteArray&#160;<i>key</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#hasFragment">hasFragment</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#hasQuery">hasQuery</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#hasQueryItem">hasQueryItem</a></b> (<i>self</i>, QString&#160;<i>key</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#host">host</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#isDetached">isDetached</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#isLocalFile">isLocalFile</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#isParentOf">isParentOf</a></b> (<i>self</i>, QUrl&#160;<i>url</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#isRelative">isRelative</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#password">password</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#path">path</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qurl.html#port">port</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qurl.html#port-2">port</a></b> (<i>self</i>, int&#160;<i>defaultPort</i>)</li><li><div class="fn" />list-of-tuple-of-QString-QString <b><a href="qurl.html#queryItems">queryItems</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#queryItemValue">queryItemValue</a></b> (<i>self</i>, QString&#160;<i>key</i>)</li><li><div class="fn" />str <b><a href="qurl.html#queryPairDelimiter">queryPairDelimiter</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qurl.html#queryValueDelimiter">queryValueDelimiter</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qurl.html#removeAllEncodedQueryItems">removeAllEncodedQueryItems</a></b> (<i>self</i>, QByteArray&#160;<i>key</i>)</li><li><div class="fn" /><b><a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a></b> (<i>self</i>, QString&#160;<i>key</i>)</li><li><div class="fn" /><b><a href="qurl.html#removeEncodedQueryItem">removeEncodedQueryItem</a></b> (<i>self</i>, QByteArray&#160;<i>key</i>)</li><li><div class="fn" /><b><a href="qurl.html#removeQueryItem">removeQueryItem</a></b> (<i>self</i>, QString&#160;<i>key</i>)</li><li><div class="fn" />QUrl <b><a href="qurl.html#resolved">resolved</a></b> (<i>self</i>, QUrl&#160;<i>relative</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#scheme">scheme</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qurl.html#setAuthority">setAuthority</a></b> (<i>self</i>, QString&#160;<i>authority</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedFragment">setEncodedFragment</a></b> (<i>self</i>, QByteArray&#160;<i>fragment</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedHost">setEncodedHost</a></b> (<i>self</i>, QByteArray&#160;<i>host</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedPassword">setEncodedPassword</a></b> (<i>self</i>, QByteArray&#160;<i>password</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedPath">setEncodedPath</a></b> (<i>self</i>, QByteArray&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedQuery">setEncodedQuery</a></b> (<i>self</i>, QByteArray&#160;<i>query</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedQueryItems">setEncodedQueryItems</a></b> (<i>self</i>, list-of-tuple-of-QByteArray-QByteArray&#160;<i>query</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedUrl">setEncodedUrl</a></b> (<i>self</i>, QByteArray&#160;<i>url</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedUrl-2">setEncodedUrl</a></b> (<i>self</i>, QByteArray&#160;<i>url</i>, ParsingMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qurl.html#setEncodedUserName">setEncodedUserName</a></b> (<i>self</i>, QByteArray&#160;<i>userName</i>)</li><li><div class="fn" /><b><a href="qurl.html#setFragment">setFragment</a></b> (<i>self</i>, QString&#160;<i>fragment</i>)</li><li><div class="fn" /><b><a href="qurl.html#setHost">setHost</a></b> (<i>self</i>, QString&#160;<i>host</i>)</li><li><div class="fn" /><b><a href="qurl.html#setPassword">setPassword</a></b> (<i>self</i>, QString&#160;<i>password</i>)</li><li><div class="fn" /><b><a href="qurl.html#setPath">setPath</a></b> (<i>self</i>, QString&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qurl.html#setPort">setPort</a></b> (<i>self</i>, int&#160;<i>port</i>)</li><li><div class="fn" /><b><a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a></b> (<i>self</i>, str&#160;<i>valueDelimiter</i>, str&#160;<i>pairDelimiter</i>)</li><li><div class="fn" /><b><a href="qurl.html#setQueryItems">setQueryItems</a></b> (<i>self</i>, list-of-tuple-of-QString-QString&#160;<i>query</i>)</li><li><div class="fn" /><b><a href="qurl.html#setScheme">setScheme</a></b> (<i>self</i>, QString&#160;<i>scheme</i>)</li><li><div class="fn" /><b><a href="qurl.html#setUrl">setUrl</a></b> (<i>self</i>, QString&#160;<i>url</i>)</li><li><div class="fn" /><b><a href="qurl.html#setUrl-2">setUrl</a></b> (<i>self</i>, QString&#160;<i>url</i>, ParsingMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qurl.html#setUserInfo">setUserInfo</a></b> (<i>self</i>, QString&#160;<i>userInfo</i>)</li><li><div class="fn" /><b><a href="qurl.html#setUserName">setUserName</a></b> (<i>self</i>, QString&#160;<i>userName</i>)</li><li><div class="fn" /><b><a href="qurl.html#swap">swap</a></b> (<i>self</i>, QUrl&#160;<i>other</i>)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#toEncoded">toEncoded</a></b> (<i>self</i>, FormattingOptions&#160;<i>options</i>&#160;=&#160;QUrl.None)</li><li><div class="fn" />QString <b><a href="qurl.html#toLocalFile">toLocalFile</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#topLevelDomain">topLevelDomain</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#toString">toString</a></b> (<i>self</i>, FormattingOptions&#160;<i>options</i>&#160;=&#160;QUrl.None)</li><li><div class="fn" />QString <b><a href="qurl.html#userInfo">userInfo</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#userName">userName</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QString <b><a href="qurl.html#fromAce">fromAce</a></b> (QByteArray)</li><li><div class="fn" />QUrl <b><a href="qurl.html#fromEncoded">fromEncoded</a></b> (QByteArray&#160;<i>url</i>)</li><li><div class="fn" />QUrl <b><a href="qurl.html#fromEncoded-2">fromEncoded</a></b> (QByteArray&#160;<i>url</i>, ParsingMode&#160;<i>mode</i>)</li><li><div class="fn" />QUrl <b><a href="qurl.html#fromLocalFile">fromLocalFile</a></b> (QString&#160;<i>localfile</i>)</li><li><div class="fn" />QString <b><a href="qurl.html#fromPercentEncoding">fromPercentEncoding</a></b> (QByteArray)</li><li><div class="fn" />QString <b><a href="qurl.html#fromPunycode">fromPunycode</a></b> (QByteArray)</li><li><div class="fn" />QUrl <b><a href="qurl.html#fromUserInput">fromUserInput</a></b> (QString&#160;<i>userInput</i>)</li><li><div class="fn" />QStringList <b><a href="qurl.html#idnWhitelist">idnWhitelist</a></b> ()</li><li><div class="fn" /><b><a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a></b> (QStringList)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#toAce">toAce</a></b> (QString)</li><li><div class="fn" />QByteArray <b><a href="qurl.html#toPercentEncoding">toPercentEncoding</a></b> (QString&#160;<i>input</i>, QByteArray&#160;<i>exclude</i>&#160;=&#160;QByteArray(), QByteArray&#160;<i>include</i>&#160;=&#160;QByteArray())</li><li><div class="fn" />QByteArray <b><a href="qurl.html#toPunycode">toPunycode</a></b> (QString)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qurl.html#__eq__">__eq__</a></b> (<i>self</i>, QUrl&#160;<i>url</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#__ge__">__ge__</a></b> (<i>self</i>, QUrl&#160;<i>url</i>)</li><li><div class="fn" />int <b><a href="qurl.html#__hash__">__hash__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#__lt__">__lt__</a></b> (<i>self</i>, QUrl&#160;<i>url</i>)</li><li><div class="fn" />bool <b><a href="qurl.html#__ne__">__ne__</a></b> (<i>self</i>, QUrl&#160;<i>url</i>)</li><li><div class="fn" />str <b><a href="qurl.html#__repr__">__repr__</a></b> (<i>self</i>)</li></ul><a name="details" /><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
"http://b&#252;hler.example.com/List of applicants.xml" would be
sent to the server as
"http://xn--bhler-kva.example.com/List%20of%20applicants.xml", and
this can be verified by calling the <a href="qurl.html#toEncoded">toEncoded</a>() function.</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>
<a id="character-conversions" name="character-conversions" />
<h4>Character Conversions</h4>
<p>Follow these rules to avoid erroneous character conversion when
dealing with URLs and strings:</p>
<ul>
<li>When creating an <a href="qstring.html">QString</a> to contain
a URL 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 QUrl(string)
and <a href="qurl.html#toString">QUrl.toString</a>() when
converting a QUrl to or from a string.</li>
</ul>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="FormattingOption-enum" />QUrl.FormattingOption</h3><p>The formatting options define how the URL is formatted when
written out as text.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.None</tt></td>
<td class="topAlign"><tt>0x0</tt></td>
<td class="topAlign">The format of the URL is unchanged.</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemoveScheme</tt></td>
<td class="topAlign"><tt>0x1</tt></td>
<td class="topAlign">The scheme is removed from the URL.</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemovePassword</tt></td>
<td class="topAlign"><tt>0x2</tt></td>
<td class="topAlign">Any password in the URL is removed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemoveUserInfo</tt></td>
<td class="topAlign"><tt>RemovePassword | 0x4</tt></td>
<td class="topAlign">Any user information in the URL is
removed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemovePort</tt></td>
<td class="topAlign"><tt>0x8</tt></td>
<td class="topAlign">Any specified port is removed from the
URL.</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemoveAuthority</tt></td>
<td class="topAlign"><tt>RemoveUserInfo | RemovePort |
0x10</tt></td>
<td class="topAlign">&#160;</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemovePath</tt></td>
<td class="topAlign"><tt>0x20</tt></td>
<td class="topAlign">The URL's path is removed, leaving only the
scheme, host address, and port (if present).</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemoveQuery</tt></td>
<td class="topAlign"><tt>0x40</tt></td>
<td class="topAlign">The query part of the URL (following a '?'
character) is removed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.RemoveFragment</tt></td>
<td class="topAlign"><tt>0x80</tt></td>
<td class="topAlign">&#160;</td>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.StripTrailingSlash</tt></td>
<td class="topAlign"><tt>0x10000</tt></td>
<td class="topAlign">The trailing slash is removed if one is
present.</td>
</tr>
</table>
<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>


<h3 class="fn"><a name="ParsingMode-enum" />QUrl.ParsingMode</h3><p>The parsing mode controls the way <a href="qurl.html">QUrl</a>
parses strings.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QUrl.TolerantMode</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign"><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 class="topAlign"><tt>QUrl.StrictMode</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Only valid URLs are accepted. This mode is
useful for general URL validation.</td>
</tr>
</table>
<p>In TolerantMode, the parser corrects the following invalid
input:</p>
<ul>
<li>Spaces and "%20": If an encoded URL contains a space, this will
be replaced with "%20". If a decoded URL contains "%20", this will
be replaced with a single space before the URL is parsed.</li>
<li>Single "%" characters: Any occurrences of a percent character
"%" not followed by exactly two hexadecimal characters (e.g., "13%
coverage.html") will be replaced by "%25".</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 / "&lt;" / "&gt;" / "[" / "" / "]" / "^" / "`" / "{" /
"|" / "}"</li>
</ul>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QUrl" />QUrl.__init__ (<i>self</i>)</h3><p>Constructs an empty <a href="qurl.html">QUrl</a> object.</p>


<h3 class="fn"><a name="QUrl-2" />QUrl.__init__ (<i>self</i>, QString&#160;<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. The default parsing mode
is <a href="qurl.html#ParsingMode-enum">TolerantMode</a>.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qurl.html">QUrl</a></span> url(<span class="string">"http://www.example.com/List of holidays.xml"</span>);
 <span class="comment">// url.toEncoded() == "http://www.example.com/List%20of%20holidays.xml"</span>
</pre>
<p>To construct a URL from an encoded string, call <a href="qurl.html#fromEncoded">fromEncoded</a>():</p>
<pre class="cpp">
 <span class="type"><a href="qurl.html">QUrl</a></span> url <span class="operator">=</span> <span class="type"><a href="qurl.html">QUrl</a></span><span class="operator">.</span><a href="qurl.html#fromEncoded">fromEncoded</a>(<span class="string">"http://qt.nokia.com/List%20of%20holidays.xml"</span>);
</pre>
<p><b>See also</b> <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" />QUrl.__init__ (<i>self</i>, QString&#160;<i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a>&#160;<i>mode</i>)</h3><p>Constructs a copy of <i>other</i>.</p>


<h3 class="fn"><a name="QUrl-4" />QUrl.__init__ (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>copy</i>)</h3><p>This is an overloaded function.</p>
<p>Parses the <i>url</i> using the parser mode <i>parsingMode</i>.
The default parsing mode is <a href="qurl.html#ParsingMode-enum">TolerantMode</a>.</p>
<p><b>See also</b> <a href="qurl.html#setUrl">setUrl</a>().</p>


<h3 class="fn"><a name="addEncodedQueryItem" />QUrl.addEncodedQueryItem (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>key</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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><b>See also</b> <a href="qurl.html#addQueryItem">addQueryItem</a>() and <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>().</p>


<h3 class="fn"><a name="addQueryItem" />QUrl.addQueryItem (<i>self</i>, QString&#160;<i>key</i>, QString&#160;<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><b>Note:</b> 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.</p>
<p><b>See also</b> <a href="qurl.html#addEncodedQueryItem">addEncodedQueryItem</a>().</p>


<h3 class="fn"><a name="allEncodedQueryItemValues" />list-of-QByteArray QUrl.allEncodedQueryItemValues (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>key</i>)</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 "search=Qt%20Rules", calling this
function with <i>key</i> = "%73earch" will return an empty
list.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qurl.html#allQueryItemValues">allQueryItemValues</a>(), <a href="qurl.html#queryItemValue">queryItemValue</a>(), and <a href="qurl.html#encodedQueryItemValue">encodedQueryItemValue</a>().</p>


<h3 class="fn"><a name="allQueryItemValues" />QStringList QUrl.allQueryItemValues (<i>self</i>, QString&#160;<i>key</i>)</h3><p>Returns the a list of query string values whose key is equal to
<i>key</i> from the URL.</p>
<p><b>Note:</b> 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.</p>
<p><b>See also</b> <a href="qurl.html#queryItemValue">queryItemValue</a>().</p>


<h3 class="fn"><a name="authority" />QString QUrl.authority (<i>self</i>)</h3><p>Returns the authority of the URL if it is defined; otherwise an
empty string is returned.</p>
<p><b>See also</b> <a href="qurl.html#setAuthority">setAuthority</a>().</p>


<h3 class="fn"><a name="clear" />QUrl.clear (<i>self</i>)</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>


<h3 class="fn"><a name="detach" />QUrl.detach (<i>self</i>)</h3><h3 class="fn"><a name="encodedFragment" /><a href="qbytearray.html">QByteArray</a> QUrl.encodedFragment (<i>self</i>)</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><b>See also</b> <a href="qurl.html#setEncodedFragment">setEncodedFragment</a>() and
<a href="qurl.html#toEncoded">toEncoded</a>().</p>


<h3 class="fn"><a name="encodedHost" /><a href="qbytearray.html">QByteArray</a> QUrl.encodedHost (<i>self</i>)</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><b>See also</b> <a href="qurl.html#setEncodedHost">setEncodedHost</a>().</p>


<h3 class="fn"><a name="encodedPassword" /><a href="qbytearray.html">QByteArray</a> QUrl.encodedPassword (<i>self</i>)</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><b>See also</b> <a href="qurl.html#setEncodedPassword">setEncodedPassword</a>() and
<a href="qurl.html#toEncoded">toEncoded</a>().</p>


<h3 class="fn"><a name="encodedPath" /><a href="qbytearray.html">QByteArray</a> QUrl.encodedPath (<i>self</i>)</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><b>See also</b> <a href="qurl.html#setEncodedPath">setEncodedPath</a>() and <a href="qurl.html#toEncoded">toEncoded</a>().</p>


<h3 class="fn"><a name="encodedQuery" /><a href="qbytearray.html">QByteArray</a> QUrl.encodedQuery (<i>self</i>)</h3><p>Returns the query string of the URL in percent encoded form.</p>
<p><b>See also</b> <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>


<h3 class="fn"><a name="encodedQueryItems" />list-of-tuple-of-QByteArray-QByteArray QUrl.encodedQueryItems (<i>self</i>)</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><b>See also</b> <a href="qurl.html#setEncodedQueryItems">setEncodedQueryItems</a>(),
<a href="qurl.html#setQueryItems">setQueryItems</a>(), and <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>


<h3 class="fn"><a name="encodedQueryItemValue" /><a href="qbytearray.html">QByteArray</a> QUrl.encodedQueryItemValue (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>key</i>)</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 "search=Qt%20Rules", calling this
function with <i>key</i> = "%73earch" will return an empty
string.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qurl.html#queryItemValue">queryItemValue</a>() and <a href="qurl.html#allQueryItemValues">allQueryItemValues</a>().</p>


<h3 class="fn"><a name="encodedUserName" /><a href="qbytearray.html">QByteArray</a> QUrl.encodedUserName (<i>self</i>)</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><b>See also</b> <a href="qurl.html#setEncodedUserName">setEncodedUserName</a>().</p>


<h3 class="fn"><a name="errorString" />QString QUrl.errorString (<i>self</i>)</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>


<h3 class="fn"><a name="fragment" />QString QUrl.fragment (<i>self</i>)</h3><p>Returns the fragment of the URL.</p>
<p><b>See also</b> <a href="qurl.html#setFragment">setFragment</a>().</p>


<h3 class="fn"><a name="fromAce" />QString QUrl.fromAce (<a href="qbytearray.html">QByteArray</a>)</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>"example.com"</tt>) to be written using
international characters.</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="fromEncoded" /><a href="qurl.html">QUrl</a> QUrl.fromEncoded (<a href="qbytearray.html">QByteArray</a>&#160;<i>url</i>)</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><b>See also</b> <a href="qurl.html#toEncoded">toEncoded</a>()
and <a href="qurl.html#setUrl">setUrl</a>().</p>


<h3 class="fn"><a name="fromEncoded-2" /><a href="qurl.html">QUrl</a> QUrl.fromEncoded (<a href="qbytearray.html">QByteArray</a>&#160;<i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a>&#160;<i>mode</i>)</h3><p>This is an overloaded function.</p>
<p>Parses the URL using <i>parsingMode</i>.</p>
<p><b>See also</b> <a href="qurl.html#toEncoded">toEncoded</a>()
and <a href="qurl.html#setUrl">setUrl</a>().</p>


<h3 class="fn"><a name="fromLocalFile" /><a href="qurl.html">QUrl</a> QUrl.fromLocalFile (QString&#160;<i>localfile</i>)</h3><p>Returns a <a href="qurl.html">QUrl</a> representation of
<i>localFile</i>, interpreted as a local file. This function
accepts paths separated by slashes as well as the native separator
for this platform.</p>
<p>This function also accepts paths with a doubled leading slash
(or backslash) to indicate a remote file, as in
"//servername/path/to/file.txt". Note that only certain platforms
can actually open this file using <a href="qfile.html#open">QFile.open</a>().</p>
<p><b>See also</b> <a href="qurl.html#toLocalFile">toLocalFile</a>(), <a href="qurl.html#isLocalFile">isLocalFile</a>(), and <a href="qdir.html#toNativeSeparators">QDir.toNativeSeparators</a>().</p>


<h3 class="fn"><a name="fromPercentEncoding" />QString QUrl.fromPercentEncoding (<a href="qbytearray.html">QByteArray</a>)</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>


<h3 class="fn"><a name="fromPunycode" />QString QUrl.fromPunycode (<a href="qbytearray.html">QByteArray</a>)</h3><h3 class="fn"><a name="fromUserInput" /><a href="qurl.html">QUrl</a> QUrl.fromUserInput (QString&#160;<i>userInput</i>)</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 id="examples" name="examples" />
<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>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="hasEncodedQueryItem" />bool QUrl.hasEncodedQueryItem (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>key</i>)</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 "search=Qt%20Rules", calling this
function with <i>key</i> = "%73earch" will return false.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qurl.html#hasQueryItem">hasQueryItem</a>().</p>


<h3 class="fn"><a name="hasFragment" />bool QUrl.hasFragment (<i>self</i>)</h3><p>Returns true if this URL contains a fragment (i.e., if # was
seen on it).</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qurl.html#fragment">fragment</a>() and
<a href="qurl.html#setFragment">setFragment</a>().</p>


<h3 class="fn"><a name="hasQuery" />bool QUrl.hasQuery (<i>self</i>)</h3><p>Returns true if this URL contains a Query (i.e., if ? was seen
on it).</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qurl.html#hasQueryItem">hasQueryItem</a>() and <a href="qurl.html#encodedQuery">encodedQuery</a>().</p>


<h3 class="fn"><a name="hasQueryItem" />bool QUrl.hasQueryItem (<i>self</i>, QString&#160;<i>key</i>)</h3><p>Returns true if there is a query string pair whose key is equal
to <i>key</i> from the URL.</p>
<p><b>See also</b> <a href="qurl.html#hasEncodedQueryItem">hasEncodedQueryItem</a>().</p>


<h3 class="fn"><a name="host" />QString QUrl.host (<i>self</i>)</h3><p>Returns the host of the URL if it is defined; otherwise an empty
string is returned.</p>
<p><b>See also</b> <a href="qurl.html#setHost">setHost</a>().</p>


<h3 class="fn"><a name="idnWhitelist" />QStringList QUrl.idnWhitelist ()</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><b>See also</b> <a href="qurl.html#setIdnWhitelist">setIdnWhitelist</a>().</p>


<h3 class="fn"><a name="isDetached" />bool QUrl.isDetached (<i>self</i>)</h3><h3 class="fn"><a name="isEmpty" />bool QUrl.isEmpty (<i>self</i>)</h3><p>Returns true if the URL has no data; otherwise returns
false.</p>


<h3 class="fn"><a name="isLocalFile" />bool QUrl.isLocalFile (<i>self</i>)</h3><p>Returns true if this URL is pointing to a local file path. A URL
is a local file path if the scheme is "file".</p>
<p>Note that this function considers URLs with hostnames to be
local file paths, even if the eventual file path cannot be opened
with <a href="qfile.html#open">QFile.open</a>().</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qurl.html#fromLocalFile">fromLocalFile</a>() and <a href="qurl.html#toLocalFile">toLocalFile</a>().</p>


<h3 class="fn"><a name="isParentOf" />bool QUrl.isParentOf (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>url</i>)</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>


<h3 class="fn"><a name="isRelative" />bool QUrl.isRelative (<i>self</i>)</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>


<h3 class="fn"><a name="isValid" />bool QUrl.isValid (<i>self</i>)</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 class="cpp">
 <span class="type">bool</span> checkUrl(<span class="keyword">const</span> <span class="type"><a href="qurl.html">QUrl</a></span> <span class="operator">&amp;</span>url) {
     <span class="keyword">if</span> (<span class="operator">!</span>url<span class="operator">.</span>isValid()) {
         <a href="qtcore.html#qDebugx">qDebug</a>(<span class="type"><a href="qstring.html">QString</a></span>(<span class="string">"Invalid URL: %1"</span>)<span class="operator">.</span>arg(url<span class="operator">.</span>toString()));
         <span class="keyword">return</span> <span class="keyword">false</span>;
     }

     <span class="keyword">return</span> <span class="keyword">true</span>;
 }
</pre>


<h3 class="fn"><a name="password" />QString QUrl.password (<i>self</i>)</h3><p>Returns the password of the URL if it is defined; otherwise an
empty string is returned.</p>
<p><b>See also</b> <a href="qurl.html#setPassword">setPassword</a>().</p>


<h3 class="fn"><a name="path" />QString QUrl.path (<i>self</i>)</h3><h3 class="fn"><a name="port" />int QUrl.port (<i>self</i>)</h3><p>Returns the port of the URL, or -1 if the port is
unspecified.</p>
<p><b>See also</b> <a href="qurl.html#setPort">setPort</a>().</p>


<h3 class="fn"><a name="port-2" />int QUrl.port (<i>self</i>, int&#160;<i>defaultPort</i>)</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 class="cpp">
 <span class="type"><a href="qftp.html">QFtp</a></span> ftp;
 ftp<span class="operator">.</span>connectToHost(url<span class="operator">.</span>host()<span class="operator">,</span> url<span class="operator">.</span>port(<span class="number">21</span>));
</pre>
<p>This function was introduced in Qt 4.1.</p>


<h3 class="fn"><a name="queryItems" />list-of-tuple-of-QString-QString QUrl.queryItems (<i>self</i>)</h3><p>Returns the query string of the URL, as a map of keys and
values.</p>
<p><b>Note:</b> 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.</p>
<p><b>See also</b> <a href="qurl.html#setQueryItems">setQueryItems</a>() and <a href="qurl.html#setEncodedQuery">setEncodedQuery</a>().</p>


<h3 class="fn"><a name="queryItemValue" />QString QUrl.queryItemValue (<i>self</i>, QString&#160;<i>key</i>)</h3><p>Returns the first query string value whose key is equal to
<i>key</i> from the URL.</p>
<p><b>Note:</b> 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.</p>
<p><b>See also</b> <a href="qurl.html#allQueryItemValues">allQueryItemValues</a>().</p>


<h3 class="fn"><a name="queryPairDelimiter" />str QUrl.queryPairDelimiter (<i>self</i>)</h3><p>Returns the character used to delimit between key-value pairs in
the query string of the URL.</p>


<h3 class="fn"><a name="queryValueDelimiter" />str QUrl.queryValueDelimiter (<i>self</i>)</h3><p>Returns the character used to delimit between keys and values in
the query string of the URL.</p>


<h3 class="fn"><a name="removeAllEncodedQueryItems" />QUrl.removeAllEncodedQueryItems (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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 "search=Qt%20Rules", calling this
function with <i>key</i> = "%73earch" will do nothing.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qurl.html#removeQueryItem">removeQueryItem</a>().</p>


<h3 class="fn"><a name="removeAllQueryItems" />QUrl.removeAllQueryItems (<i>self</i>, QString&#160;<i>key</i>)</h3><p>Removes all the query string pairs whose key is equal to
<i>key</i> from the URL.</p>
<p><b>See also</b> <a href="qurl.html#removeQueryItem">removeQueryItem</a>().</p>


<h3 class="fn"><a name="removeEncodedQueryItem" />QUrl.removeEncodedQueryItem (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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 "search=Qt%20Rules", calling this
function with <i>key</i> = "%73earch" will do nothing.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qurl.html#removeQueryItem">removeQueryItem</a>() and <a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a>().</p>


<h3 class="fn"><a name="removeQueryItem" />QUrl.removeQueryItem (<i>self</i>, QString&#160;<i>key</i>)</h3><p>Removes the first query string pair whose key is equal to
<i>key</i> from the URL.</p>
<p><b>See also</b> <a href="qurl.html#removeAllQueryItems">removeAllQueryItems</a>().</p>


<h3 class="fn"><a name="resolved" /><a href="qurl.html">QUrl</a> QUrl.resolved (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>relative</i>)</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 class="cpp">
 <span class="type"><a href="qurl.html">QUrl</a></span> baseUrl(<span class="string">"http://qt.nokia.com/support"</span>);
 <span class="type"><a href="qurl.html">QUrl</a></span> relativeUrl(<span class="string">"../products/solutions"</span>);
 <a href="qtcore.html#qDebugx">qDebug</a>(baseUrl<span class="operator">.</span>resolved(relativeUrl)<span class="operator">.</span>toString());
 <span class="comment">// prints "http://qt.nokia.com/products/solutions"</span>
</pre>
<p>Calling resolved() with ".." returns a <a href="qurl.html">QUrl</a> whose directory is one level higher than the
original. Similarly, calling resolved() with "../.." removes two
levels from the path. If <i>relative</i> is "/", the path becomes
"/".</p>
<p><b>See also</b> <a href="qurl.html#isRelative">isRelative</a>().</p>


<h3 class="fn"><a name="scheme" />QString QUrl.scheme (<i>self</i>)</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><b>See also</b> <a href="qurl.html#setScheme">setScheme</a>()
and <a href="qurl.html#isRelative">isRelative</a>().</p>


<h3 class="fn"><a name="setAuthority" />QUrl.setAuthority (<i>self</i>, QString&#160;<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="index.html">@</a>', and the host and port are separated by a ':'.
If the user info is empty, the '<a href="index.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 class="centerAlign"><img alt="" src="images/qurl-authority.png" /></p>
<p><b>See also</b> <a href="qurl.html#authority">authority</a>().</p>


<h3 class="fn"><a name="setEncodedFragment" />QUrl.setEncodedFragment (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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 class="centerAlign"><img alt="" src="images/qurl-fragment.png" /></p>
<p>The fragment is sometimes also referred to as the URL
"reference".</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>("") (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 "#").</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qurl.html#setFragment">setFragment</a>() and <a href="qurl.html#encodedFragment">encodedFragment</a>().</p>


<h3 class="fn"><a name="setEncodedHost" />QUrl.setEncodedHost (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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><b>See also</b> <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>


<h3 class="fn"><a name="setEncodedPassword" />QUrl.setEncodedPassword (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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><b>See also</b> <a href="qurl.html#setPassword">setPassword</a>(), <a href="qurl.html#encodedPassword">encodedPassword</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>


<h3 class="fn"><a name="setEncodedPath" />QUrl.setEncodedPath (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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 class="centerAlign"><img alt="" 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 class="centerAlign"><img alt="" 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><b>See also</b> <a href="qurl.html#setPath">setPath</a>(),
<a href="qurl.html#encodedPath">encodedPath</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>


<h3 class="fn"><a name="setEncodedQuery" />QUrl.setEncodedQuery (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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>("") will set the query to an empty
value, as if the original URL had a lone "?".</p>
<p><b>See also</b> <a href="qurl.html#encodedQuery">encodedQuery</a>() and <a href="qurl.html#hasQuery">hasQuery</a>().</p>


<h3 class="fn"><a name="setEncodedQueryItems" />QUrl.setEncodedQueryItems (<i>self</i>, list-of-tuple-of-QByteArray-QByteArray&#160;<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><b>See also</b> <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>(), <a href="qurl.html#encodedQueryItems">encodedQueryItems</a>(), and <a href="qurl.html#setQueryItems">setQueryItems</a>().</p>


<h3 class="fn"><a name="setEncodedUrl" />QUrl.setEncodedUrl (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>url</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><b>See also</b> <a href="qurl.html#setUrl">setUrl</a>().</p>


<h3 class="fn"><a name="setEncodedUrl-2" />QUrl.setEncodedUrl (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a>&#160;<i>mode</i>)</h3><p>Constructs a URL by parsing the contents of <i>encodedUrl</i>
using the given <i>parsingMode</i>.</p>


<h3 class="fn"><a name="setEncodedUserName" />QUrl.setEncodedUserName (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<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><b>See also</b> <a href="qurl.html#setUserName">setUserName</a>(), <a href="qurl.html#encodedUserName">encodedUserName</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>


<h3 class="fn"><a name="setFragment" />QUrl.setFragment (<i>self</i>, QString&#160;<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 class="centerAlign"><img alt="" src="images/qurl-fragment.png" /></p>
<p>The fragment is sometimes also referred to as the URL
"reference".</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>("") (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 "#").</p>
<p><b>See also</b> <a href="qurl.html#fragment">fragment</a>() and
<a href="qurl.html#hasFragment">hasFragment</a>().</p>


<h3 class="fn"><a name="setHost" />QUrl.setHost (<i>self</i>, QString&#160;<i>host</i>)</h3><p>Sets the host of the URL to <i>host</i>. The host is part of the
authority.</p>
<p><b>See also</b> <a href="qurl.html#host">host</a>() and <a href="qurl.html#setAuthority">setAuthority</a>().</p>


<h3 class="fn"><a name="setIdnWhitelist" />QUrl.setIdnWhitelist (QStringList)</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>Note that if you call this function, you need to do so <b class="redFont"><code>\em</code></b> before you start any threads that
might access <a href="qurl.html#idnWhitelist">idnWhitelist</a>().</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><b>See also</b> <a href="qurl.html#idnWhitelist">idnWhitelist</a>().</p>


<h3 class="fn"><a name="setPassword" />QUrl.setPassword (<i>self</i>, QString&#160;<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><b>See also</b> <a href="qurl.html#password">password</a>() and
<a href="qurl.html#setUserInfo">setUserInfo</a>().</p>


<h3 class="fn"><a name="setPath" />QUrl.setPath (<i>self</i>, QString&#160;<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 class="centerAlign"><img alt="" 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 class="centerAlign"><img alt="" src="images/qurl-mailtopath.png" /></p>
<p><b>See also</b> <a href="qurl.html#pathx">path</a>().</p>


<h3 class="fn"><a name="setPort" />QUrl.setPort (<i>self</i>, int&#160;<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><b>See also</b> <a href="qurl.html#port">port</a>().</p>


<h3 class="fn"><a name="setQueryDelimiters" />QUrl.setQueryDelimiters (<i>self</i>, str&#160;<i>valueDelimiter</i>, str&#160;<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 class="centerAlign"><img alt="" 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 class="cpp">
 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>


<h3 class="fn"><a name="setQueryItems" />QUrl.setQueryItems (<i>self</i>, list-of-tuple-of-QString-QString&#160;<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><b>Note:</b> 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.</p>
<p><b>See also</b> <a href="qurl.html#setQueryDelimiters">setQueryDelimiters</a>(), <a href="qurl.html#queryItems">queryItems</a>(), and <a href="qurl.html#setEncodedQueryItems">setEncodedQueryItems</a>().</p>


<h3 class="fn"><a name="setScheme" />QUrl.setScheme (<i>self</i>, QString&#160;<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 "ftp":</p>
<p class="centerAlign"><img alt="" src="images/qurl-authority2.png" /></p>
<p>The scheme can also be empty, in which case the URL is
interpreted as relative.</p>
<p><b>See also</b> <a href="qurl.html#scheme">scheme</a>() and
<a href="qurl.html#isRelative">isRelative</a>().</p>


<h3 class="fn"><a name="setUrl" />QUrl.setUrl (<i>self</i>, QString&#160;<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><b>See also</b> <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>().</p>


<h3 class="fn"><a name="setUrl-2" />QUrl.setUrl (<i>self</i>, QString&#160;<i>url</i>, <a href="qurl.html#ParsingMode-enum">ParsingMode</a>&#160;<i>mode</i>)</h3><p>This is an overloaded function.</p>
<p>Parses <i>url</i> using the parsing mode <i>parsingMode</i>.</p>
<p><b>See also</b> <a href="qurl.html#setEncodedUrl">setEncodedUrl</a>().</p>


<h3 class="fn"><a name="setUserInfo" />QUrl.setUserInfo (<i>self</i>, QString&#160;<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 class="centerAlign"><img alt="" src="images/qurl-authority3.png" /></p>
<p><b>See also</b> <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>


<h3 class="fn"><a name="setUserName" />QUrl.setUserName (<i>self</i>, QString&#160;<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><b>See also</b> <a href="qurl.html#setEncodedUserName">setEncodedUserName</a>(), <a href="qurl.html#userName">userName</a>(), and <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>


<h3 class="fn"><a name="swap" />QUrl.swap (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>other</i>)</h3><p>Swaps URL <i>other</i> with this URL. This operation is very
fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>


<h3 class="fn"><a name="toAce" /><a href="qbytearray.html">QByteArray</a> QUrl.toAce (QString)</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>"example.com"</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>


<h3 class="fn"><a name="toEncoded" /><a href="qbytearray.html">QByteArray</a> QUrl.toEncoded (<i>self</i>, <a href="qurl-formattingoptions.html">FormattingOptions</a>&#160;<i>options</i>&#160;=&#160;QUrl.None)</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>


<h3 class="fn"><a name="toLocalFile" />QString QUrl.toLocalFile (<i>self</i>)</h3><p>Returns the path of this URL formatted as a local file path. The
path returned will use forward slashes, even if it was originally
created from one with backslashes.</p>
<p>If this URL contains a non-empty hostname, it will be encoded in
the returned value in the form found on SMB networks (for example,
"//servername/path/to/file.txt").</p>
<p>If this is a relative URL, in Qt 4.x this function returns the
path to maintain backward compatability. This will change from 5.0
onwards. Then the path is returned only for URLs where the scheme
is "file", and for all other URLs an empty string is returned.</p>
<p><b>See also</b> <a href="qurl.html#fromLocalFile">fromLocalFile</a>() and <a href="qurl.html#isLocalFile">isLocalFile</a>().</p>


<h3 class="fn"><a name="toPercentEncoding" /><a href="qbytearray.html">QByteArray</a> QUrl.toPercentEncoding (QString&#160;<i>input</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>exclude</i>&#160;=&#160;QByteArray(), <a href="qbytearray.html">QByteArray</a>&#160;<i>include</i>&#160;=&#160;QByteArray())</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 / "-" / "." / "<a href="index.html">_</a>" / "~"</p>
<pre class="cpp">
 <span class="type"><a href="qbytearray.html">QByteArray</a></span> ba <span class="operator">=</span> <span class="type"><a href="qurl.html">QUrl</a></span><span class="operator">.</span>toPercentEncoding(<span class="string">"{a fishy string?}"</span><span class="operator">,</span> <span class="string">"{}"</span><span class="operator">,</span> <span class="string">"s"</span>);
 <a href="qtcore.html#qDebugx">qDebug</a>(ba<span class="operator">.</span>constData());
 <span class="comment">// prints "{a fi%73hy %73tring%3F}"</span>
</pre>


<h3 class="fn"><a name="topLevelDomain" />QString QUrl.topLevelDomain (<i>self</i>)</h3><p>Returns the TLD (Top-Level Domain) of the URL, (e.g. .co.uk,
.net). Note that the return value is prefixed with a '.' unless the
URL does not contain a valid TLD, in which case the function
returns an empty string.</p>
<p>This function was introduced in Qt 4.8.</p>


<h3 class="fn"><a name="toPunycode" /><a href="qbytearray.html">QByteArray</a> QUrl.toPunycode (QString)</h3><h3 class="fn"><a name="toString" />QString QUrl.toString (<i>self</i>, <a href="qurl-formattingoptions.html">FormattingOptions</a>&#160;<i>options</i>&#160;=&#160;QUrl.None)</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><b>See also</b> <a href="qurl.html#FormattingOption-enum">FormattingOptions</a> and
<a href="qurl.html#toEncoded">toEncoded</a>().</p>


<h3 class="fn"><a name="userInfo" />QString QUrl.userInfo (<i>self</i>)</h3><p>Returns the user info of the URL, or an empty string if the user
info is undefined.</p>
<p><b>See also</b> <a href="qurl.html#setUserInfo">setUserInfo</a>().</p>


<h3 class="fn"><a name="userName" />QString QUrl.userName (<i>self</i>)</h3><p>Returns the user name of the URL if it is defined; otherwise an
empty string is returned.</p>
<p><b>See also</b> <a href="qurl.html#setUserName">setUserName</a>() and <a href="qurl.html#encodedUserName">encodedUserName</a>().</p>


<h3 class="fn"><a name="__eq__" />bool QUrl.__eq__ (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>url</i>)</h3><h3 class="fn"><a name="__ge__" />bool QUrl.__ge__ (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>url</i>)</h3><h3 class="fn"><a name="__hash__" />int QUrl.__hash__ (<i>self</i>)</h3><h3 class="fn"><a name="__lt__" />bool QUrl.__lt__ (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>url</i>)</h3><h3 class="fn"><a name="__ne__" />bool QUrl.__ne__ (<i>self</i>, <a href="qurl.html">QUrl</a>&#160;<i>url</i>)</h3><h3 class="fn"><a name="__repr__" />str QUrl.__repr__ (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.11.2 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://qt.digia.com">Digia</a> 2014</td><td align="right" width="25%">Qt&#160;4.8.6</td></tr></table></div></address></body></html>