Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QMacPasteboardMime Class

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

 #include <QMacPasteboardMime>

This class was introduced in Qt 4.2.

Public Functions

QMacPasteboardMime(char t)
virtual ~QMacPasteboardMime()
virtual bool canConvert(const QString & mime, QString flav) = 0
virtual QList<QByteArray> convertFromMime(const QString & mime, QVariant data, QString flav) = 0
virtual QVariant convertToMime(const QString & mime, QList<QByteArray> data, QString flav) = 0
virtual QString convertorName() = 0
virtual int count(QMimeData * mimeData)
virtual QString flavorFor(const QString & mime) = 0
virtual QString mimeFor(QString flav) = 0

Static Public Members

QList<QMacPasteboardMime *> all(uchar t)
QMacPasteboardMime * convertor(uchar t, const QString & mime, QString flav)
QString flavorToMime(uchar t, QString flav)

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:

public.utf8-plain-text - converts to "text/plain" public.utf16-plain-text - converts to "text/plain" public.html - converts to "text/html" public.url - converts to "text/uri-list" public.file-url - converts to "text/uri-list" public.tiff - converts to "application/x-qt-image" public.vcard - converts to "text/plain" com.apple.traditional-mac-plain-text - converts to "text/plain" com.apple.pict - converts to "application/x-qt-image"

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.

Member Function Documentation

QMacPasteboardMime::QMacPasteboardMime(char t)

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

QMacPasteboardMime::~QMacPasteboardMime() [virtual]

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

QList<QMacPasteboardMime *> QMacPasteboardMime::all(uchar t) [static]

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

bool QMacPasteboardMime::canConvert(const QString & mime, QString flav) [pure virtual]

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

All subclasses must reimplement this pure virtual function.

QList<QByteArray> QMacPasteboardMime::convertFromMime(const QString & mime, QVariant data, QString flav) [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.

QVariant QMacPasteboardMime::convertToMime(const QString & mime, QList<QByteArray> data, QString flav) [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.

QMacPasteboardMime * QMacPasteboardMime::convertor(uchar t, const QString & mime, QString flav) [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.

QString QMacPasteboardMime::convertorName() [pure virtual]

Returns a name for the convertor.

All subclasses must reimplement this pure virtual function.

int QMacPasteboardMime::count(QMimeData * mimeData) [virtual]

Returns the item count for the given mimeData

QString QMacPasteboardMime::flavorFor(const QString & mime) [pure virtual]

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(uchar t, QString flav) [static]

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

QString QMacPasteboardMime::mimeFor(QString flav) [pure virtual]

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.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web