内容表

上一话题

QMimeDatabase

下一话题

QModelIndex

QMimeType

QMimeType class describes types of file or data, represented by a MIME type string. 更多

Inheritance diagram of PySide2.QtCore.QMimeType

New in version 5.0.

概要

函数

详细描述

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 icon 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.

class QMimeType

QMimeType(other)

param other

QMimeType

Constructs this QMimeType object initialized with default property values that indicate an invalid MIME type.

PySide2.QtCore.QMimeType. aliases ( )
返回类型

字符串列表

PySide2.QtCore.QMimeType. allAncestors ( )
返回类型

字符串列表

PySide2.QtCore.QMimeType. comment ( )
返回类型

unicode

PySide2.QtCore.QMimeType. filterString ( )
返回类型

unicode

PySide2.QtCore.QMimeType. genericIconName ( )
返回类型

unicode

PySide2.QtCore.QMimeType. globPatterns ( )
返回类型

字符串列表

PySide2.QtCore.QMimeType. iconName ( )
返回类型

unicode

PySide2.QtCore.QMimeType. 继承 ( mimeTypeName )
参数

mimeTypeName – unicode

返回类型

bool

返回 true if this mimetype is mimeTypeName , or inherits mimeTypeName (见 parentMimeTypes() ),或 mimeTypeName is an alias for this mimetype.

This method has been made invokable from QML since 5.10.

PySide2.QtCore.QMimeType. isDefault ( )
返回类型

bool

PySide2.QtCore.QMimeType. isValid ( )
返回类型

bool

PySide2.QtCore.QMimeType. name ( )
返回类型

unicode

PySide2.QtCore.QMimeType. __ne__ ( other )
参数

other QMimeType

返回类型

bool

返回 true if other does not equal this QMimeType object, otherwise returns false .

PySide2.QtCore.QMimeType. __eq__ ( other )
参数

other QMimeType

返回类型

bool

返回 true if other equals this QMimeType object, otherwise returns false . The name is the unique identifier for a mimetype, so two mimetypes with the same name, are equal.

PySide2.QtCore.QMimeType. parentMimeTypes ( )
返回类型

字符串列表

PySide2.QtCore.QMimeType. preferredSuffix ( )
返回类型

unicode

PySide2.QtCore.QMimeType. suffixes ( )
返回类型

字符串列表

PySide2.QtCore.QMimeType. swap ( other )
参数

other QMimeType

交换 QMimeType other with this QMimeType 对象。

此操作非常快且从不失败。

The method helps with the implementation of assignment operators in an exception-safe way. For more information consult More C++ Idioms - Copy-and-swap .