Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to encode URL parameters in QT?

I have the following URL

QString url = "http://www.gigacooldomainname.com/" + setName + "/" + fileName + ".jpg"

where setName and fileName are QString variables.

I wish to have the following:

QString url = "http://www.gigacooldomainname.com/" + QUrlParameter::encode(setName) + "/" + QUrlParameter::encode(fileName) + ".jpg"

Unfortunately there is not such QUrlParameter class or encode method.

I know I can write one by myself but was curious if there is already an existing solution in QT4.

I am also not interested in Q3Url::encode solution since I don't have the Q3Url headers.

like image 650
Gad D Lord Avatar asked Aug 22 '10 12:08

Gad D Lord


1 Answers

Use QUrl::toPercentEncoding (static method ;))

like image 87
Rob Zombie Avatar answered Sep 28 '22 08:09

Rob Zombie