Quote Originally Posted by jacek View Post
Are you sure this creates a valid QUrl object? What does "youhome.isValid()" return? Shouldn't there be "file://" in front of the string?
Now is running .....

If i write a Qurl class i append this small code..... on return value....

Qt Code:
  1. QString IsNetFile( QString fullFileName )
  2. {
  3. if (fullFileName.startsWith("http://", Qt::CaseInsensitive) or
  4. fullFileName.startsWith("https://", Qt::CaseInsensitive) or
  5. fullFileName.startsWith("ftp://", Qt::CaseInsensitive) or
  6. fullFileName.startsWith("news://", Qt::CaseInsensitive) or
  7. fullFileName.startsWith("mailto:", Qt::CaseInsensitive) or
  8. fullFileName.startsWith("webdav://", Qt::CaseInsensitive) )
  9. {
  10. return fullFileName;
  11. } else {
  12. return fullFileName.prepend("file:///");
  13. }
  14. }
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. #include <QDesktopServices>
  2. #define HOME_DIR_YOUR \
  3. QString( "%1/ale.png" ).arg( QDir::homePath())
  4.  
  5. qDebug() << "### HOME_DIR_YOUR " << HOME_DIR_YOUR;
  6. QUrl youhome(HOME_DIR_YOUR.prepend("file:///")); /* filee path not open */
  7. qDebug() << "### youhome.toString() " << youhome.toString();
  8. qDebug() << "### youhome.toLocalFile() " << youhome.toLocalFile();
  9. QUrl youhome1("http://www.qtcentre.org/forum/"); /* running open browser*/
  10. QDesktopServices::openUrl (youhome);
  11.  
  12.  
  13.  
  14. ### HOME_DIR_YOUR "C:/Documents and Settings/ppk-it/ale.png"
  15. ### youhome.toString() "file:///C:/Documents and Settings/ppk-it/ale.png"
  16. ### youhome.toLocalFile() "C:/Documents and Settings/ppk-it/ale.png"
To copy to clipboard, switch view to plain text mode