[Qt-interest] How to get an icon associated with a certain filetype using Qt?
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Mar 24 10:45:02 CET 2010
André Somers wrote on Wednesday, March 24, 2010 8:32 AM:
> ...
> Perhaps studying the sources of QFileIconProvider will help you get
> what you want. I just looked, and at least for windows it seems to
> use the file extension. Do you happen to have the file name too?
And does it really have to be the icon of the application which can deal with that MIME type? Or would "generic" icons be sufficient?
Note that on Windows the "application registration" is really based on the extension, such as *.jpg, so in theory there could be dozens of applications on a computer which could deal with e.g. MIME "image/jpeg", but only one which is actually registered to open *.jpg files (e.g. the Windows Image Preview). So just having the MIME type wouldn't help you anyway, if you really wanted to have the (or all) icon(s) of the registered application(s).
Alternatively you could specify your own "generic" icons for
- image/png, image/jpg, image/tiff etc -> "image icon"
- text/plain -> "text icon"
- text/html -> "HTML icon"
- etc.
I just stumbled across the following document: http://msdn.microsoft.com/en-us/library/ms775147%28VS.85%29.aspx
It also contains a list of "known MIME types" (well, the most common ones at least you are likely to stumble across within a browser, I guess).
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list