I use a URL entered by the user as text to initialize a QUrl object. Later I want to convert the QUrl back into a string for displaying it and to check it using regular expr
I am not sure why toDisplayString(QUrl::FullyDecoded)
does not work.
After trying several versions I have found that copy.query(QUrl::FullyDecoded)
does decode the query part. The Documentation has an example with the the following code does return the decoded URL:
QUrl url("http://test.com/query?q=%2B%2Be%3Axyz%2Fen");
url.setQuery(url.query(QUrl::FullyDecoded), QUrl::DecodedMode);
qDebug() << url.toString();
To solve the problem this way is not optimal because the query part is copied without need.