Hello,

Is there any way to retrieve the icon of a file given the file's pathname? In particular, I am attempting to retrieve an application's icon.

I have been able to do this for Windows using SHGetFileInfo(), but my application needs to be cross-platform and this (obviously) won't work for Mac or Linux.

I have also tried the following:
Qt Code:
  1. QString file = "C:\application.exe";
  2. QFileInfo fileInfo( file );
  3. QFileIconProvider fileIconProvider;
  4. QIcon appIcon = fileIconProvider.icon( fileInfo );
To copy to clipboard, switch view to plain text mode 
However this always returns the system's default icon for folders and files rather than the file's specific icon.

Any suggestions or thoughts on how I could do this would be most appreciated.
(I'm using Qt 4.2.2)

Thanks