QWinMime Class

The QWinMime class maps open-standard MIME to Window Clipboard formats. More...

Header: #include <QWinMime>
qmake: QT += winextras
Since: Qt 5.4

This class was introduced in Qt 5.4.

Public Functions

QWinMime()
virtual ~QWinMime()

Static Public Members

int registerMimeType(const QString &mime)

Detailed Description

Qt's drag-and-drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol, but on Windows although some applications use MIME types to describe clipboard formats, others use arbitrary non-standardized naming conventions, or unnamed built-in formats of Windows.

By instantiating subclasses of QWinMime that provide conversions between Windows Clipboard and MIME formats, you can convert proprietary clipboard formats to MIME formats.

Qt has predefined support for the following Windows Clipboard formats:

Windows FormatEquivalent MIME type
CF_UNICODETEXTtext/plain
CF_TEXTtext/plain
CF_DIBimage/xyz, where xyz is a Qt image format
CF_HDROPtext/uri-list
CF_INETURLtext/uri-list
CF_HTMLtext/html

An example use of this class would be to map the Windows Metafile clipboard format (CF_METAFILEPICT) to and from the MIME type image/x-wmf. This conversion might simply be adding or removing a header, or even just passing on the data. See Drag and Drop for more information on choosing and definition MIME types.

You can check if a MIME type is convertible using canConvertFromMime() and can perform conversions with convertToMime() and convertFromMime().

Member Function Documentation

QWinMime::QWinMime()

Constructs a new conversion object, adding it to the globally accessed list of available converters.

[virtual] QWinMime::~QWinMime()

Destroys a conversion object, removing it from the global list of available converters.

[static] int QWinMime::registerMimeType(const QString &mime)

Registers the MIME type mime, and returns an ID number identifying the format on Windows.