KFileMetaData::MimeUtils Namespace

namespace KFileMetaData::MimeUtils

The MimeUtils namespace. More...

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

Functions

(since 5.57) QMimeType strictMimeType(const QString &filePath, const QMimeDatabase &db)

Detailed Description

Function Documentation

[since 5.57] 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.

This function was introduced in 5.57.

See also QMimeDatabase::mimeTypesForFileName and QMimeType::inherits.