So far, I get icon file like this

Qt Code:
  1. QIcon Olongia::fileIcon(const QString &filename)
  2. {
  3. QFileInfo info(filename);
  4. const QString ext=info.suffix().toLower();
  5.  
  6. QIcon icon;
  7. if (ext == "pdf") {
  8. icon=QIcon::fromTheme("application-pdf");
  9. } else if (ext.startsWith("doc")) {
  10. icon=QIcon::fromTheme("application-msword");
  11. } else if (ext=="zip" ||
  12. ext=="gz" ||
  13. ext=="bz2" ) {
  14. icon=QIcon::fromTheme("application-x-archive");
  15. } else if (ext=="png" ||
  16. ext=="jpg" ||
  17. ext=="gif" ||
  18. ext=="svg" ||
  19. ext=="bmp") {
  20. icon=QIcon::fromTheme("image-x-generic");
  21. } else {
  22. QProxyStyle s;
  23. icon=s.standardIcon (QStyle::SP_FileIcon);
  24. }
  25.  
  26. return icon;
  27. }
To copy to clipboard, switch view to plain text mode 

I think that is not efficient, and after read qtdoc I get new trick like this

Qt Code:
  1. QFileInfo info(filename);
  2. QIcon icon=ip.icon(info);
To copy to clipboard, switch view to plain text mode 

But, that code only working if file is exists in local system. And I need get file type icon for file not exists in local system ? Like QFtp example, only get the filename and show in the TreeViewWidget ?

Thank's before and sorry about my suck english