FITS file mimeDB.mimeTypeForFile() problem
-
In 6.5.1 the QMimeType object returned for a FITS file was inherited from "image/fits" so this code:
QFileInfo info{ path }; QMimeDatabase mimeDB{ }; auto mime = mimeDB.mimeTypeForFile(info); qDebug() << "mime.inherits(\"image/fits\"); returns" << mime.inherits("image/fits");got me:
mime.inherits("image/fits"); returns true
That code in 6.8.0 results in:
mime.inherits("image/fits"); returns false
adding a qDebug() << mime; gave me:
QMimeType("application/fits")
That's a bit of a NASTY incompatibility.
David -
QMimeDatabase will use a system copy of MIME data if one is present (usually Linux) and an internal copy if one is not.
According to the docs, the built-in copy comes from FreeDesktop shared-mime-info. For Qt 6.5.1 this was release 2.2. This lists "application/fits" as the primary type with alias "image/fits".
Release 2.1 of this set does list "image/fits". This was last in Qt 6.3.
Docs notwithstanding, Qt 6.7 switched to a MIME database from Apache Tika . This lists "application/fits" with no aliases.
Is it possible that the "image/fits" return came from a system database or Qt 6.3 or earlier? My Ubuntu 24.04 has the 2.4 release of the FreeDesktop data.