Qt 4.8
|
The QMacPasteboardMime class converts between a MIME type and a. More...
#include <qmime.h>
Public Types | |
enum | QMacPasteboardMimeType { MIME_DND =0x01, MIME_CLIP =0x02, MIME_QT_CONVERTOR =0x04, MIME_QT3_CONVERTOR =0x08, MIME_ALL =MIME_DND|MIME_CLIP } |
Public Functions | |
virtual bool | canConvert (const QString &mime, QString flav)=0 |
Returns true if the convertor can convert (both ways) between mime and flav; otherwise returns false. More... | |
virtual QList< QByteArray > | convertFromMime (const QString &mime, QVariant data, QString flav)=0 |
Returns data converted from MIME type mime to Mac UTI flav. More... | |
virtual QString | convertorName ()=0 |
Returns a name for the convertor. More... | |
virtual QVariant | convertToMime (const QString &mime, QList< QByteArray > data, QString flav)=0 |
Returns data converted from Mac UTI flav to MIME type mime. More... | |
virtual QString | flavorFor (const QString &mime)=0 |
Returns the Mac UTI used for MIME type mime, or 0 if this convertor does not support mime. More... | |
virtual QString | mimeFor (QString flav)=0 |
Returns the MIME UTI used for Mac flavor flav, or 0 if this convertor does not support flav. More... | |
QMacPasteboardMime (char) | |
Constructs a new conversion object of type t, adding it to the globally accessed list of available convertors. More... | |
virtual | ~QMacPasteboardMime () |
Destroys a conversion object, removing it from the global list of available convertors. More... | |
Static Public Functions | |
static QList< QMacPasteboardMime * > | all (uchar) |
Returns a list of all currently defined QMacPasteboardMime objects of type t. More... | |
static QMacPasteboardMime * | convertor (uchar, const QString &mime, QString flav) |
Returns the most-recently created QMacPasteboardMime of type t that can convert between the mime and flav formats. More... | |
static QString | flavorToMime (uchar, QString flav) |
Returns a MIME type of type t for flav, or 0 if none exists. More... | |
static void | initialize () |
This is an internal function. More... | |
Properties | |
char | type |
Related Functions | |
(Note that these are not member functions.) | |
void | qRegisterDraggedTypes (const QStringList &types) |
Registers the given types as custom pasteboard types. More... | |
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().
Enumerator | |
---|---|
MIME_DND | |
MIME_CLIP | |
MIME_QT_CONVERTOR | |
MIME_QT3_CONVERTOR | |
MIME_ALL |
|
explicit |
Constructs a new conversion object of type t, adding it to the globally accessed list of available convertors.
Definition at line 180 of file qmime_mac.cpp.
Referenced by QMacPasteboardMimeHTMLText::convertFromMime(), and QMacPasteboardMimeVCard::convertFromMime().
|
virtual |
Destroys a conversion object, removing it from the global list of available convertors.
Definition at line 189 of file qmime_mac.cpp.
|
static |
Returns a list of all currently defined QMacPasteboardMime objects of type t.
Definition at line 1244 of file qmime_mac.cpp.
Referenced by QMacPasteboard::retrieveData(), and QMacPasteboard::setMimeData().
Returns true if the convertor can convert (both ways) between mime and flav; otherwise returns false.
All subclasses must reimplement this pure virtual function.
Implemented in QMacPasteboardMimeVCard, QMacPasteboardMimeUrl, QMacPasteboardMimeFileUri, QMacPasteboardMimeTiff, QMacPasteboardMimeHTMLText, QMacPasteboardMimeUnicodeText, QMacPasteboardMimePlainText, QMacPasteboardMimeTypeName, and QMacPasteboardMimeAny.
Referenced by QMacPasteboardMimeHTMLText::convertFromMime(), QMacPasteboardMimeTiff::convertFromMime(), QMacPasteboardMimeFileUri::convertFromMime(), QMacPasteboardMimeUrl::convertFromMime(), QMacPasteboardMimeVCard::convertFromMime(), QMacPasteboardMimeHTMLText::convertToMime(), QMacPasteboardMimeTiff::convertToMime(), QMacPasteboardMimeFileUri::convertToMime(), QMacPasteboardMimeUrl::convertToMime(), QMacPasteboard::promiseKeeper(), QMacPasteboardMimeFileUri::QMacPasteboardMimeFileUri(), QMacPasteboardMimeHTMLText::QMacPasteboardMimeHTMLText(), QMacPasteboardMimePlainText::QMacPasteboardMimePlainText(), QMacPasteboardMimeTiff::QMacPasteboardMimeTiff(), QMacPasteboardMimeUnicodeText::QMacPasteboardMimeUnicodeText(), QMacPasteboardMimeUrl::QMacPasteboardMimeUrl(), QMacPasteboardMimeVCard::QMacPasteboardMimeVCard(), QMacPasteboardMimeAny::~QMacPasteboardMimeAny(), and QMacPasteboardMimeTypeName::~QMacPasteboardMimeTypeName().
|
pure virtual |
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.
Implemented in QMacPasteboardMimeVCard, QMacPasteboardMimeUrl, QMacPasteboardMimeFileUri, QMacPasteboardMimeTiff, QMacPasteboardMimeHTMLText, QMacPasteboardMimeUnicodeText, QMacPasteboardMimePlainText, QMacPasteboardMimeTypeName, and QMacPasteboardMimeAny.
Referenced by QMacPasteboardMimeHTMLText::convertFromMime(), QMacPasteboardMimeVCard::convertFromMime(), QMacPasteboard::promiseKeeper(), QMacPasteboardMimeFileUri::QMacPasteboardMimeFileUri(), QMacPasteboardMimeHTMLText::QMacPasteboardMimeHTMLText(), QMacPasteboardMimePlainText::QMacPasteboardMimePlainText(), QMacPasteboardMimeTiff::QMacPasteboardMimeTiff(), QMacPasteboardMimeUnicodeText::QMacPasteboardMimeUnicodeText(), QMacPasteboardMimeUrl::QMacPasteboardMimeUrl(), QMacPasteboardMimeVCard::QMacPasteboardMimeVCard(), QMacPasteboard::setMimeData(), QMacPasteboardMimeAny::~QMacPasteboardMimeAny(), and QMacPasteboardMimeTypeName::~QMacPasteboardMimeTypeName().
|
static |
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.
Definition at line 1196 of file qmime_mac.cpp.
|
pure virtual |
Returns a name for the convertor.
All subclasses must reimplement this pure virtual function.
Implemented in QMacPasteboardMimeVCard, QMacPasteboardMimeUrl, QMacPasteboardMimeFileUri, QMacPasteboardMimeTiff, QMacPasteboardMimeHTMLText, QMacPasteboardMimeUnicodeText, QMacPasteboardMimePlainText, QMacPasteboardMimeTypeName, and QMacPasteboardMimeAny.
Referenced by QMacPasteboardMimeHTMLText::convertFromMime(), QMacPasteboardMimeVCard::convertFromMime(), QMacPasteboard::promiseKeeper(), QMacPasteboardMimeFileUri::QMacPasteboardMimeFileUri(), QMacPasteboardMimeHTMLText::QMacPasteboardMimeHTMLText(), QMacPasteboardMimePlainText::QMacPasteboardMimePlainText(), QMacPasteboardMimeTiff::QMacPasteboardMimeTiff(), QMacPasteboardMimeUnicodeText::QMacPasteboardMimeUnicodeText(), QMacPasteboardMimeUrl::QMacPasteboardMimeUrl(), QMacPasteboardMimeVCard::QMacPasteboardMimeVCard(), QMacPasteboard::retrieveData(), QMacPasteboard::setMimeData(), QMacPasteboardMimeAny::~QMacPasteboardMimeAny(), and QMacPasteboardMimeTypeName::~QMacPasteboardMimeTypeName().
|
pure virtual |
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.
Implemented in QMacPasteboardMimeVCard, QMacPasteboardMimeUrl, QMacPasteboardMimeFileUri, QMacPasteboardMimeTiff, QMacPasteboardMimeHTMLText, QMacPasteboardMimeUnicodeText, QMacPasteboardMimePlainText, QMacPasteboardMimeTypeName, and QMacPasteboardMimeAny.
Referenced by QMacPasteboardMimeHTMLText::convertFromMime(), QMacPasteboardMimeVCard::convertFromMime(), QMacPasteboardMimeFileUri::QMacPasteboardMimeFileUri(), QMacPasteboardMimeHTMLText::QMacPasteboardMimeHTMLText(), QMacPasteboardMimePlainText::QMacPasteboardMimePlainText(), QMacPasteboardMimeTiff::QMacPasteboardMimeTiff(), QMacPasteboardMimeUnicodeText::QMacPasteboardMimeUnicodeText(), QMacPasteboardMimeUrl::QMacPasteboardMimeUrl(), QMacPasteboardMimeVCard::QMacPasteboardMimeVCard(), QMacPasteboard::retrieveData(), QMacPasteboardMimeAny::~QMacPasteboardMimeAny(), and QMacPasteboardMimeTypeName::~QMacPasteboardMimeTypeName().
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.
Implemented in QMacPasteboardMimeVCard, QMacPasteboardMimeUrl, QMacPasteboardMimeFileUri, QMacPasteboardMimeTiff, QMacPasteboardMimeHTMLText, QMacPasteboardMimeUnicodeText, QMacPasteboardMimePlainText, QMacPasteboardMimeTypeName, and QMacPasteboardMimeAny.
Referenced by QMacPasteboardMimePlainText::canConvert(), QMacPasteboardMimeUnicodeText::canConvert(), QMacPasteboardMimeHTMLText::canConvert(), QMacPasteboardMimeHTMLText::convertFromMime(), QMacPasteboardMimeVCard::convertFromMime(), QMacPasteboardMimeFileUri::QMacPasteboardMimeFileUri(), QMacPasteboardMimeHTMLText::QMacPasteboardMimeHTMLText(), QMacPasteboardMimePlainText::QMacPasteboardMimePlainText(), QMacPasteboardMimeTiff::QMacPasteboardMimeTiff(), QMacPasteboardMimeUnicodeText::QMacPasteboardMimeUnicodeText(), QMacPasteboardMimeUrl::QMacPasteboardMimeUrl(), QMacPasteboardMimeVCard::QMacPasteboardMimeVCard(), QMacPasteboard::retrieveData(), QMacPasteboard::setMimeData(), QMacPasteboard::~QMacPasteboard(), QMacPasteboardMimeAny::~QMacPasteboardMimeAny(), and QMacPasteboardMimeTypeName::~QMacPasteboardMimeTypeName().
Returns a MIME type of type t for flav, or 0 if none exists.
Definition at line 1221 of file qmime_mac.cpp.
Referenced by QMacPasteboard::formats(), and QMacPasteboard::hasFormat().
|
static |
This is an internal function.
Definition at line 1162 of file qmime_mac.cpp.
Referenced by qt_init().
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.
Implemented in QMacPasteboardMimeVCard, QMacPasteboardMimeUrl, QMacPasteboardMimeFileUri, QMacPasteboardMimeTiff, QMacPasteboardMimeHTMLText, QMacPasteboardMimeUnicodeText, QMacPasteboardMimePlainText, QMacPasteboardMimeTypeName, and QMacPasteboardMimeAny.
Referenced by QMacPasteboardMimeAny::canConvert(), QMacPasteboardMimeVCard::canConvert(), QMacPasteboardMimeHTMLText::convertFromMime(), QMacPasteboardMimeVCard::convertFromMime(), QMacPasteboardMimeFileUri::QMacPasteboardMimeFileUri(), QMacPasteboardMimeHTMLText::QMacPasteboardMimeHTMLText(), QMacPasteboardMimePlainText::QMacPasteboardMimePlainText(), QMacPasteboardMimeTiff::QMacPasteboardMimeTiff(), QMacPasteboardMimeUnicodeText::QMacPasteboardMimeUnicodeText(), QMacPasteboardMimeUrl::QMacPasteboardMimeUrl(), QMacPasteboardMimeVCard::QMacPasteboardMimeVCard(), QMacPasteboardMimeAny::~QMacPasteboardMimeAny(), and QMacPasteboardMimeTypeName::~QMacPasteboardMimeTypeName().
|
related |
Registers the given types as custom pasteboard types.
This function should be called to enable the Drag and Drop events for custom pasteboard types on Cocoa implementations. This is required in addition to a QMacPasteboardMime subclass implementation. By default drag and drop is enabled for all standard pasteboard types.