Home · All Classes · Modules

QMacPasteboardMime Class Reference
[QtGui module]

The QMacPasteboardMime class converts between a MIME type and a Uniform Type Identifier (UTI) format. More...

Types

Methods

Static Methods


Detailed Description

The QMacPasteboardMime class converts between a MIME type and a Uniform Type Identifier (UTI) format.

Qt's drag and drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol. On Mac, although some applications use MIME to describe clipboard contents, it is more common to use Apple's UTI format.

QMacPasteboardMime's role is to bridge the gap between MIME and UTI; By subclasses this class, one can extend Qt's drag and drop and clipboard handling to convert to and from unsupported, or proprietary, UTI formats.

A subclass of QMacPasteboardMime will automatically be registered, and active, upon instantiation.

Qt has predefined support for the following UTIs:

When working with MIME data, Qt will interate through all instances of QMacPasteboardMime to find an instance that can convert to, or from, a specific MIME type. It will do this by calling canConvert() on each instance, starting with (and choosing) the last created instance first. The actual conversions will be done by using convertToMime() and convertFromMime().

Note: The API uses the term "flavor" in some cases. This is for backwards compatibility reasons, and should now be understood as UTIs.


Type Documentation

QMacPasteboardMime.QMacPasteboardMimeType


Method Documentation

QMacPasteboardMime.__init__ (self, int t)

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

QMacPasteboardMime.__init__ (self, QMacPasteboardMime)

list-of-QMacPasteboardMime QMacPasteboardMime.all (int t)

Returns a list of all currently defined QMacPasteboardMime objects of type t.

bool QMacPasteboardMime.canConvert (self, QString mime, QString flav)

This method is abstract and should be reimplemented in any sub-class.

Returns true if the convertor can convert (both ways) between mime and flav; otherwise returns false.

All subclasses must reimplement this pure virtual function.

list-of-QByteArray QMacPasteboardMime.convertFromMime (self, QString mime, QVariant data, QString flav)

This method is abstract and should be reimplemented in any sub-class.

Returns data converted from MIME type mime to Mac UTI flav.

Note that Mac flavors must all be self-terminating. The return value may contain trailing data.

All subclasses must reimplement this pure virtual function.

QMacPasteboardMime QMacPasteboardMime.convertor (int t, QString mime, QString flav)

Returns the most-recently created QMacPasteboardMime of type t that can convert between the mime and flav formats. Returns 0 if no such convertor exists.

QString QMacPasteboardMime.convertorName (self)

This method is abstract and should be reimplemented in any sub-class.

Returns a name for the convertor.

All subclasses must reimplement this pure virtual function.

QVariant QMacPasteboardMime.convertToMime (self, QString mime, list-of-QByteArray data, QString flav)

This method is abstract and should be reimplemented in any sub-class.

Returns data converted from Mac UTI flav to MIME type mime.

Note that Mac flavors must all be self-terminating. The input data may contain trailing data.

All subclasses must reimplement this pure virtual function.

QString QMacPasteboardMime.flavorFor (self, QString mime)

This method is abstract and should be reimplemented in any sub-class.

Returns the Mac UTI used for MIME type mime, or 0 if this convertor does not support mime.

All subclasses must reimplement this pure virtual function.

QString QMacPasteboardMime.flavorToMime (int t, QString flav)

Returns a MIME type of type t for flav, or 0 if none exists.

QString QMacPasteboardMime.mimeFor (self, QString flav)

This method is abstract and should be reimplemented in any sub-class.

Returns the MIME UTI used for Mac flavor flav, or 0 if this convertor does not support flav.

All subclasses must reimplement this pure virtual function.


PyQt 4.10.1 for MacOSCopyright © Riverbank Computing Ltd and Nokia 2012Qt 4.8.4