24 #include <QMimeDatabase> 43 return QMimeDatabase().mimeTypeForData(Data).name();
50 return QMimeDatabase().mimeTypeForData(Device).name();
57 if (FileName.isEmpty() || !Device)
60 return QMimeDatabase().mimeTypeForFileNameAndData(FileName, Device).name();
66 if (FileName.isEmpty() || Data.isEmpty())
69 return QMimeDatabase().mimeTypeForFileNameAndData(FileName, Data).name();
75 return QMimeDatabase().mimeTypeForName(Name).name();
81 return QMimeDatabase().mimeTypeForUrl(Url).name();
89 QList<QMimeType> types = QMimeDatabase().mimeTypesForFileName(FileName);
90 foreach (
const QMimeType &type, types)
91 result << type.name();
93 (void)result.removeDuplicates();
103 QStringList extensions;
105 QList<QMimeType> mimes = QMimeDatabase().allMimeTypes();
106 foreach (
const QMimeType &mime, mimes)
107 if (mime.name().startsWith(Type, Qt::CaseInsensitive))
108 extensions.append(mime.suffixes());
110 (void)extensions.removeDuplicates();
static QStringList MimeTypeForFileName(const QString &FileName)
Return a list of possible MIME types for the file named Name.
static QString MimeTypeForFileNameAndData(const QString &FileName, QIODevice *Device)
Return a MIME type for the media described by FileName and Device.
static QString MimeTypeForData(const QByteArray &Data)
Return a MIME type for the media described by Data.
static QString MimeTypeForUrl(const QUrl &Url)
Return a MIME type for the media pointed to by Url.
static QStringList ExtensionsForType(const QString &Type)
Returns a list of known file extensions for a given top level MIME type.
static QString MimeTypeForName(const QString &Name)
Return a MIME type for the file named Name.