Simply dont use path(), instead use text parsing, here is an example:
Qt Code:
  1. bool HttpGetFile::ParseUrl( const QString& qstrUrlIn, int& iError )
  2. {
  3. QString qstrUrl = qstrUrlIn;
  4.  
  5. QUrl qUrl( qstrUrl );
  6.  
  7. if( qstrUrlIn.length() == (qUrl.scheme().length() + 3 + qUrl.host().length()) )
  8. {
  9. qstrUrl += "/";
  10. qUrl = qstrUrl;
  11. }
  12.  
  13. if( !qUrl.isValid() )
  14. {
  15. iError = 8;
  16. return false;
  17. }
  18.  
  19. if( qUrl.scheme() != "http" )
  20. {
  21. iError = 9;
  22. return false;
  23. }
  24.  
  25. qstrHost = qUrl.host();
  26. qstrPath = qstrUrl.remove( 0, 7 + qstrHost.length() );// 7 == http://
  27.  
  28. return true;
  29. }
To copy to clipboard, switch view to plain text mode