QUrl url("bword://blood transfusion");
QString res = url.toString();
Why I got the string “bword:” instead of “bword://blood transfusion”?
How can I get the string “bword://blood transfusion” form the QUrl?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
URL syntax can be quite complex, see this Wikipedia article. The problem is that your URL does not contain authority field, it only has scheme field “bword” and path “//blood transfusion”. And according to the RFC3986 – Uniform Resource Identifier (URI): Generic Syntax:
So your URL is not valid (although
isValid()returns true). Change your code to: