[Qt-interest] [Fwd: Re: Identify mimetype]
Andre Somers
andre at familiesomers.nl
Mon Mar 7 14:54:23 CET 2011
(sorry, emailed privately at first)
Op Ma, 7 maart, 2011 2:02 pm, schreef Marcelo Estanislau Geyer:
>
> Hi,
>
> I have not found a way to identify the mimetype of a file. I need to
> display the icon for the file format. Any suggestion is welcome, need
> something cross platform (Linux and Windows). Thanks
If the file exists on disk, then you may use QFileIconProvider to retreive
the icon. This is not a complete solution for getting the mime-type for a
file though, especially if you also need to get it based on just a file
name without having a real file on disk. Also note that it may be
impossible to get a (single) mime type based on just a file (name). There
is no 1:1 mapping between file extensions and mime types or programs that
can operate on that type.
André
More information about the Qt-interest-old
mailing list