Pages
API Documentation
On this page

KFileMetaData::MimeUtils Namespace

The MimeUtils namespace. More...

  • Header: #include <MimeUtils>
  • CMake: find_package(KF6 REQUIRED COMPONENTS FileMetaData)
    target_link_libraries(mytarget PRIVATE KF6::FileMetaData)

Detailed Description

Function Documentation

QMimeType MimeUtils::strictMimeType(const QString &filePath, const QMimeDatabase &db)

Returns the MIME type for a file

The function uses both content and filename to determine the QMimeType. In case the extension MIME type is more specific than the content MIME type, and the first inherits the latter, the extension MIME type is preferred. If the extension does not match the content, the content has higher priority. The file must exist and be readable.

See also QMimeDatabase::mimeTypesForFileName, QMimeType::inherits

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.