QMimeType¶
- PyQt5.QtCore.QMimeType
Description¶
The QMimeType class describes types of file or data, represented by a MIME type string.
For instance a file named “readme.txt” has the MIME type “text/plain”. The MIME type can be determined from the file name, or from the file contents, or from both. MIME type determination can also be done on buffers of data not coming from files.
Determining the MIME type of a file can be useful to make sure your application supports it. It is also useful in file-manager-like applications or widgets, in order to display an appropriate iconName() for the file, or even the descriptive comment() in detailed views.
To check if a file has the expected MIME type, you should use inherits() rather than a simple string comparison based on the name(). This is because MIME types can inherit from each other: for instance a C source file is a specific type of plain text file, so text/x-csrc inherits text/plain.
See also
Methods¶
- __init__()
TODO
- __init__(QMimeType)
TODO
- aliases() → List[str]
TODO
- allAncestors() → List[str]
TODO
- comment() → str
TODO
- __eq__(QMimeType) → bool
TODO
- filterString() → str
TODO
- genericIconName() → str
TODO
- globPatterns() → List[str]
TODO
- __hash__() → int
TODO
- iconName() → str
TODO
- inherits(str) → bool
TODO
- isDefault() → bool
TODO
- isValid() → bool
TODO
- name() → str
TODO
- __ne__(QMimeType) → bool
TODO
- parentMimeTypes() → List[str]
TODO
- preferredSuffix() → str
TODO
- suffixes() → List[str]
TODO
- swap(QMimeType)
TODO