MimeDatabase
Qt Base Class: QMimeDatabase
Signature: QMimeDatabase(self) -> None
Base classes
Name |
Children |
Inherits |
QMimeDatabase PySide6.QtCore QMimeDatabase(self) -> None |
|
|
⋔ Inheritance diagram
graph TD
1473299881392["core.MimeDatabase"]
1473243817408["QtCore.QMimeDatabase"]
1473291690208["Shiboken.Object"]
140713234304496["builtins.object"]
1473243817408 --> 1473299881392
1473291690208 --> 1473243817408
140713234304496 --> 1473291690208
🛈 DocStrings
Bases: QMimeDatabase
Maintains a database of MIME types.
Source code in prettyqt\core\mimedatabase.py
| class MimeDatabase(core.QMimeDatabase):
"""Maintains a database of MIME types."""
def get_mime_type_for_file(
self,
path: datatypes.PathType | core.QFileInfo,
match_mode: MatchModeStr | core.QMimeDatabase.MatchMode = "default",
) -> core.MimeType:
if isinstance(path, os.PathLike):
path = os.fspath(path)
mime_type = self.mimeTypeForFile(path, MATCH_MODE.get_enum_value(match_mode))
return core.MimeType(mime_type)
def get_mime_type_for_data(
self, data: datatypes.ByteArrayType | core.QIODevice
) -> core.MimeType:
return core.MimeType(self.mimeTypeForData(data))
def get_mime_type_for_filename_and_data(
self, filename: os.PathLike, data: datatypes.ByteArrayType | core.QIODevice
) -> core.MimeType:
path = os.fspath(filename)
return core.MimeType(self.mimeTypeForFileNameAndData(path, data))
def get_mime_type_for_name(self, name: str) -> core.MimeType:
return core.MimeType(self.mimeTypeForName(name))
def get_mime_type_for_url(self, url: core.QUrl | str) -> core.MimeType:
url = core.QUrl(url) if isinstance(url, str) else url
return core.MimeType(self.mimeTypeForUrl(url))
def get_mime_types_for_filename(
self, filename: datatypes.PathType
) -> list[core.MimeType]:
path = os.fspath(filename)
return [core.MimeType(i) for i in self.mimeTypesForFileName(path)]
|