I have a QUrl and I need to extract the path+file+params. Basically everything but the hostname - what would be requested via HTTP.
I looked through the Qt 4.6 docs but I couldn't find anything that looked like it would do this.
What method(s) would I call?
You can clear the scheme with setScheme
. After that the url will be relative so it shouldn't return the hostname anymore when converting it to a string.
QUrl someUrl("http://stackoverflow.com/foo/bar?spam=eggs");
someUrl.setScheme("");
someUrl.toString();
Or, you can give the toString()
method some extra parameters:
QUrl someUrl("http://stackoverflow.com/foo/bar?spam=eggs");
someUrl.toString(QUrl::RemoveScheme);