~ubuntu-branches/ubuntu/natty/pyside/natty-proposed

1 by Didier Raboud
Import upstream version 0.2.3
1
//! [0]
2
url = QUrl("http://www.example.com/List of holidays.xml")
3
# url.toEncoded() == "http://www.example.com/List%20of%20holidays.xml"
4
//! [0]
5
6
7
//! [1]
8
url = QUrl.fromEncoded("http://qtsoftware.com/List%20of%20holidays.xml")
9
//! [1]
10
11
12
//! [2]
13
def checkUrl(url):
14
    if !url.isValid():
1.1.5 by Didier Raboud
Import upstream version 1.0.0~beta5
15
        print "Invalid URL: %s" % url.toString()
16
        return False
1 by Didier Raboud
Import upstream version 0.2.3
17
1.1.5 by Didier Raboud
Import upstream version 1.0.0~beta5
18
    return True
1 by Didier Raboud
Import upstream version 0.2.3
19
20
//! [2]
21
22
23
//! [3]
24
ftp = QFtp()
25
ftp.connectToHost(url.host(), url.port(21))
26
//! [3]
27
28
29
//! [4]
30
http://www.example.com/cgi-bin/drawgraph.cgi?type-pie/color-green
31
//! [4]
32
33
34
//! [5]
35
baseUrl = QUrl("http://qtsoftware.com/support")
36
relativeUrl = QUrl("../products/solutions")
37
print baseUrl.resolved(relativeUrl).toString()
38
# prints "http://qtsoftware.com/products/solutions"
39
//! [5]
40
41
42
//! [6]
43
ba = QUrl.toPercentEncoding("{a fishy string?}", "{}", "s")
1.1.5 by Didier Raboud
Import upstream version 1.0.0~beta5
44
print ba
1 by Didier Raboud
Import upstream version 0.2.3
45
# prints "{a fi%73hy %73tring%3F}"
46
//! [6]