Qt 4.8
|
The QWindowsMime class maps open-standard MIME to Window Clipboard formats. More...
#include <qmime.h>
Public Functions | |
virtual bool | canConvertFromMime (const FORMATETC &formatetc, const QMimeData *mimeData) const =0 |
Returns true if the converter can convert from the mimeData to the format specified in formatetc. More... | |
virtual bool | canConvertToMime (const QString &mimeType, IDataObject *pDataObj) const =0 |
Returns true if the converter can convert to the mimeType from the available formats in pDataObj. More... | |
virtual bool | convertFromMime (const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const =0 |
Convert the mimeData to the format specified in formatetc. More... | |
virtual QVariant | convertToMime (const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const =0 |
Returns a QVariant containing the converted data for mimeType from pDataObj. More... | |
virtual QVector< FORMATETC > | formatsForMime (const QString &mimeType, const QMimeData *mimeData) const =0 |
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that can be provided for the mimeType from the mimeData. More... | |
virtual QString | mimeForFormat (const FORMATETC &formatetc) const =0 |
Returns the mime type that will be created form the format specified in formatetc, or an empty string if this converter does not support formatetc. More... | |
QWindowsMime () | |
Constructs a new conversion object, adding it to the globally accessed list of available converters. More... | |
virtual | ~QWindowsMime () |
Destroys a conversion object, removing it from the global list of available converters. More... | |
Static Public Functions | |
static int | registerMimeType (const QString &mime) |
Registers the MIME type mime, and returns an ID number identifying the format on Windows. More... | |
Static Private Functions | |
static QVector< FORMATETC > | allFormatsForMime (const QMimeData *mimeData) |
static QStringList | allMimesForFormats (IDataObject *pDataObj) |
static QWindowsMime * | converterFromMime (const FORMATETC &formatetc, const QMimeData *mimeData) |
static QWindowsMime * | converterToMime (const QString &mimeType, IDataObject *pDataObj) |
Friends | |
class | QClipboardWatcher |
class | QDragManager |
class | QDropData |
class | QOleDataObject |
The QWindowsMime class maps open-standard MIME to Window Clipboard formats.
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 QWindowsMime 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 Format | Equivalent MIME type |
CF_UNICODETEXT | text/plain |
CF_TEXT | text/plain |
CF_DIB | image/xyz , where xyz is a Qt image format |
CF_HDROP | text/uri-list |
CF_INETURL | text/uri-list |
CF_HTML | text/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().
QWindowsMime::QWindowsMime | ( | ) |
Constructs a new conversion object, adding it to the globally accessed list of available converters.
Definition at line 264 of file qmime_win.cpp.
|
virtual |
Destroys a conversion object, removing it from the global list of available converters.
Definition at line 273 of file qmime_win.cpp.
Definition at line 375 of file qmime_win.cpp.
Referenced by QOleDataObject::EnumFormatEtc().
|
staticprivate |
Definition at line 392 of file qmime_win.cpp.
Referenced by QOleDropTarget::Drop(), and QClipboardWatcher::formats_sys().
|
pure virtual |
Returns true if the converter can convert from the mimeData to the format specified in formatetc.
All subclasses must reimplement this pure virtual function.
Implemented in QLastResortMimes, QBuiltInMimes, QWindowsMimeImage, QWindowsMimeHtml, QWindowsMimeURI, and QWindowsMimeText.
Referenced by converterFromMime().
|
pure virtual |
Returns true if the converter can convert to the mimeType from the available formats in pDataObj.
All subclasses must reimplement this pure virtual function.
Implemented in QLastResortMimes, QBuiltInMimes, QWindowsMimeImage, QWindowsMimeHtml, QWindowsMimeURI, and QWindowsMimeText.
Referenced by converterToMime().
|
staticprivate |
Definition at line 355 of file qmime_win.cpp.
Referenced by QOleDataObject::GetData(), and QOleDataObject::QueryGetData().
|
staticprivate |
Definition at line 365 of file qmime_win.cpp.
Referenced by QOleDropTarget::Drop(), QClipboardWatcher::hasFormat_sys(), and QClipboardWatcher::retrieveData_sys().
|
pure virtual |
Convert the mimeData to the format specified in formatetc.
The converted data should then be placed in pmedium structure.
Return true if the conversion was successful.
All subclasses must reimplement this pure virtual function.
Implemented in QLastResortMimes, QBuiltInMimes, QWindowsMimeImage, QWindowsMimeHtml, QWindowsMimeURI, and QWindowsMimeText.
Referenced by QOleDataObject::GetData().
|
pure virtual |
Returns a QVariant containing the converted data for mimeType from pDataObj.
If possible the QVariant should be of the preferredType to avoid needless conversions.
All subclasses must reimplement this pure virtual function.
Implemented in QLastResortMimes, QBuiltInMimes, QWindowsMimeImage, and QWindowsMimeHtml.
Referenced by QOleDropTarget::Drop(), and QClipboardWatcher::retrieveData_sys().
|
pure virtual |
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that can be provided for the mimeType from the mimeData.
All subclasses must reimplement this pure virtual function.
Implemented in QLastResortMimes, QBuiltInMimes, QWindowsMimeImage, QWindowsMimeHtml, QWindowsMimeURI, and QWindowsMimeText.
Referenced by allFormatsForMime().
Returns the mime type that will be created form the format specified in formatetc, or an empty string if this converter does not support formatetc.
All subclasses must reimplement this pure virtual function.
Implemented in QLastResortMimes, QBuiltInMimes, QWindowsMimeImage, QWindowsMimeHtml, QWindowsMimeURI, and QWindowsMimeText.
Referenced by allMimesForFormats().
|
static |
Registers the MIME type mime, and returns an ID number identifying the format on Windows.
Definition at line 283 of file qmime_win.cpp.
Referenced by QLastResortMimes::canConvertToMime(), QLastResortMimes::convertToMime(), QLastResortMimes::formatsForMime(), QBuiltInMimes::QBuiltInMimes(), QWindowsMimeHtml::QWindowsMimeHtml(), and QWindowsMimeURI::QWindowsMimeURI().
|
friend |
|
friend |
|
friend |