PythonQt.QtCore.QMimeDatabase · declarations 001
Back to PythonQt.QtCore.QMimeDatabase
MatchContent
instance-attribute
MatchContent: Any
MatchDefault
instance-attribute
MatchDefault: Any
MatchExtension
instance-attribute
MatchExtension: Any
MatchMode
instance-attribute
MatchMode: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
allMimeTypes
allMimeTypes() -> tuple
X.allMimeTypes() -> tuple
Supplemental documentation: Qt 5 reference:
QList\<QMimeType> QMimeDatabase::allMimeTypes() const
Returns the list of all available MIME types.
This can be useful for showing all MIME types to the user, for instance in a MIME type editor. Do not use unless really necessary in other cases though, prefer using the mimeTypeForXxx() methods for performance reasons.
Upstream PySide2 reference signatures (binding differences may apply):
allMimeTypes(self) -> typing.List[PySide2.QtCore.QMimeType]
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#allMimeTypes
mimeTypeForData
mimeTypeForData(device: Any) -> Any
X.mimeTypeForData(device) -> PythonQt.QtCore.QMimeType
Supplemental documentation: Qt 5 reference:
QMimeType QMimeDatabase::mimeTypeForData(const QByteArray \&data) const
Returns a MIME type for data.
A valid MIME type is always returned. If data doesn't match any known MIME type data, the default MIME type (application/octet-stream) is returned.
QMimeType QMimeDatabase::mimeTypeForData(QIODevice *device) const
Returns a MIME type for the data in device.
A valid MIME type is always returned. If the data in device doesn't match any known MIME type data, the default MIME type (application/octet-stream) is returned.
Upstream PySide2 reference signatures (binding differences may apply):
mimeTypeForData(self, data: PySide2.QtCore.QByteArray) -> PySide2.QtCore.QMimeType
mimeTypeForData(self, device: PySide2.QtCore.QIODevice) -> PySide2.QtCore.QMimeType
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#mimeTypeForData
mimeTypeForFile
mimeTypeForFile(fileInfo: Any, mode: Any) -> Any
X.mimeTypeForFile(fileInfo, mode) -> PythonQt.QtCore.QMimeType
Supplemental documentation: Qt 5 reference:
QMimeType QMimeDatabase::mimeTypeForFile(const QFileInfo \&fileInfo, QMimeDatabase::MatchMode mode \= MatchDefault) const
Returns a MIME type for fileInfo.
A valid MIME type is always returned.
The default matching algorithm looks at both the file name and the file contents, if necessary. The file extension has priority over the contents, but the contents will be used if the file extension is unknown, or matches multiple MIME types. If fileInfo is a Unix symbolic link, the file that it refers to will be used instead. If the file doesn't match any known pattern or data, the default MIME type (application/octet-stream) is returned.
When mode is set to MatchExtension, only the file name is used, not the file contents. The file doesn't even have to exist. If the file name doesn't match any known pattern, the default MIME type (application/octet-stream) is returned. If multiple MIME types match this file, the first one (alphabetically) is returned.
When mode is set to MatchContent, and the file is readable, only the file contents are used to determine the MIME type. This is equivalent to calling mimeTypeForData with a QFile as input device.
fileInfo may refer to an absolute or relative path.
See also QMimeType::isDefault() and mimeTypeForData().
QMimeType QMimeDatabase::mimeTypeForFile(const QString \&fileName, QMimeDatabase::MatchMode mode \= MatchDefault) const
Returns a MIME type for the file named fileName using mode.
This is an overloaded function.
Upstream PySide2 reference signatures (binding differences may apply):
mimeTypeForFile(self, fileInfo: PySide2.QtCore.QFileInfo, mode: PySide2.QtCore.QMimeDatabase.MatchMode=...) -> PySide2.QtCore.QMimeType
mimeTypeForFile(self, fileName: str, mode: PySide2.QtCore.QMimeDatabase.MatchMode=...) -> PySide2.QtCore.QMimeType
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#mimeTypeForFile
mimeTypeForFileNameAndData
mimeTypeForFileNameAndData(fileName: str, device: Any) -> Any
X.mimeTypeForFileNameAndData(fileName, device) -> PythonQt.QtCore.QMimeType
Supplemental documentation: Qt 5 reference:
QMimeType QMimeDatabase::mimeTypeForFileNameAndData(const QString \&fileName, QIODevice *device) const
Returns a MIME type for the given fileName and device data.
This overload can be useful when the file is remote, and we started to download some of its data in a device. This allows to do full MIME type matching for remote files as well.
If the device is not open, it will be opened by this function, and closed after the MIME type detection is completed.
A valid MIME type is always returned. If device data doesn't match any known MIME type data, the default MIME type (application/octet-stream) is returned.
This method looks at both the file name and the file contents, if necessary. The file extension has priority over the contents, but the contents will be used if the file extension is unknown, or matches multiple MIME types.
QMimeType QMimeDatabase::mimeTypeForFileNameAndData(const QString \&fileName, const QByteArray \&data) const
Returns a MIME type for the given fileName and device data.
This overload can be useful when the file is remote, and we started to download some of its data. This allows to do full MIME type matching for remote files as well.
A valid MIME type is always returned. If data doesn't match any known MIME type data, the default MIME type (application/octet-stream) is returned.
This method looks at both the file name and the file contents, if necessary. The file extension has priority over the contents, but the contents will be used if the file extension is unknown, or matches multiple MIME types.
Upstream PySide2 reference signatures (binding differences may apply):
mimeTypeForFileNameAndData(self, fileName: str, data: PySide2.QtCore.QByteArray) -> PySide2.QtCore.QMimeType
mimeTypeForFileNameAndData(self, fileName: str, device: PySide2.QtCore.QIODevice) -> PySide2.QtCore.QMimeType
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#mimeTypeForFileNameAndData
mimeTypeForName
mimeTypeForName(nameOrAlias: str) -> Any
X.mimeTypeForName(nameOrAlias) -> PythonQt.QtCore.QMimeType
Supplemental documentation: Qt 5 reference:
QMimeType QMimeDatabase::mimeTypeForName(const QString \&nameOrAlias) const
Returns a MIME type for nameOrAlias or an invalid one if none found.
Upstream PySide2 reference signatures (binding differences may apply):
mimeTypeForName(self, nameOrAlias: str) -> PySide2.QtCore.QMimeType
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#mimeTypeForName
mimeTypeForUrl
mimeTypeForUrl(url: Any) -> Any
X.mimeTypeForUrl(url) -> PythonQt.QtCore.QMimeType
Supplemental documentation: Qt 5 reference:
QMimeType QMimeDatabase::mimeTypeForUrl(const QUrl \&url) const
Returns a MIME type for url.
If the URL is a local file, this calls mimeTypeForFile.
Otherwise the matching is done based on the file name only, except for schemes where file names don't mean much, like HTTP. This method always returns the default mimetype for HTTP URLs, use QNetworkAccessManager to handle HTTP URLs properly.
A valid MIME type is always returned. If url doesn't match any known MIME type data, the default MIME type (application/octet-stream) is returned.
Upstream PySide2 reference signatures (binding differences may apply):
mimeTypeForUrl(self, url: PySide2.QtCore.QUrl) -> PySide2.QtCore.QMimeType
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#mimeTypeForUrl
mimeTypesForFileName
mimeTypesForFileName(fileName: str) -> tuple
X.mimeTypesForFileName(fileName) -> tuple
Supplemental documentation: Qt 5 reference:
QList\<QMimeType> QMimeDatabase::mimeTypesForFileName(const QString \&fileName) const
Returns the MIME types for the file name fileName.
If the file name doesn't match any known pattern, an empty list is returned. If multiple MIME types match this file, they are all returned.
This function does not try to open the file. To also use the content when determining the MIME type, use mimeTypeForFile() or mimeTypeForFileNameAndData() instead.
See also mimeTypeForFile().
Upstream PySide2 reference signatures (binding differences may apply):
mimeTypesForFileName(self, fileName: str) -> typing.List[PySide2.QtCore.QMimeType]
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#mimeTypesForFileName
suffixForFileName
suffixForFileName(fileName: str) -> str
X.suffixForFileName(fileName) -> str
Supplemental documentation: Qt 5 reference:
QString QMimeDatabase::suffixForFileName(const QString \&fileName) const
Returns the suffix for the file fileName, as known by the MIME database.
This allows to pre-select "tar.bz2" for foo.tar.bz2, but still only "txt" for my.file.with.dots.txt.
Upstream PySide2 reference signatures (binding differences may apply):
suffixForFileName(self, fileName: str) -> str
Source: https://doc.qt.io/archives/qt-5.15/qmimedatabase.html#suffixForFileName