61 #if defined(Q_OS_WINCE) 67 #ifndef QT_NO_IMAGEFORMAT_BMP 75 #define BMP_LCS_sRGB 0x73524742 76 #define BMP_LCS_GM_IMAGES 0x00000004L 127 return formatetc.cfFormat;
133 formatetc.cfFormat = cf;
134 formatetc.dwAspect = DVASPECT_CONTENT;
135 formatetc.lindex = -1;
136 formatetc.ptd = NULL;
137 formatetc.tymed = TYMED_HGLOBAL;
143 HGLOBAL hData = GlobalAlloc(0, data.
size());
147 void *out = GlobalLock(hData);
148 memcpy(out, data.
data(), data.
size());
150 pmedium->tymed = TYMED_HGLOBAL;
151 pmedium->hGlobal = hData;
152 pmedium->pUnkForRelease = 0;
161 if (pDataObj->GetData(&formatetc, &s) == S_OK) {
162 DWORD * val = (DWORD*)GlobalLock(s.hGlobal);
165 GlobalUnlock(s.hGlobal);
166 ReleaseStgMedium(&s);
169 formatetc.tymed = TYMED_ISTREAM;
170 if (pDataObj->GetData(&formatetc, &s) == S_OK) {
172 ULONG actualRead = 0;
173 LARGE_INTEGER pos = {{0, 0}};
175 HRESULT hr = s.pstm->Seek(pos, STREAM_SEEK_SET, NULL);
176 while(SUCCEEDED(hr)){
177 hr = s.pstm->Read(szBuffer,
sizeof(szBuffer), &actualRead);
178 if (SUCCEEDED(hr) && actualRead > 0) {
181 if (actualRead !=
sizeof(szBuffer))
185 ReleaseStgMedium(&s);
194 if (pDataObj->QueryGetData(&formatetc) != S_OK){
195 formatetc.tymed = TYMED_ISTREAM;
196 return pDataObj->QueryGetData(&formatetc) == S_OK;
266 theMimeList()->addWindowsMime(
this);
275 theMimeList()->removeWindowsMime(
this);
285 int f = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (mime.
utf16()));
287 qErrnoWarning(
"QWindowsMime::registerMimeType: Failed to register clipboard format");
358 for (
int i=mimes.
size()-1; i>=0; --i) {
368 for (
int i=mimes.
size()-1; i>=0; --i) {
380 #ifndef QT_NO_DRAGANDDROP 382 for (
int f=0; f<formats.
size(); ++f) {
383 for (
int i=mimes.
size()-1; i>=0; --i)
388 #endif //QT_NO_DRAGANDDROP 396 LPENUMFORMATETC FAR fmtenum;
397 HRESULT hr = pDataObj->EnumFormatEtc(DATADIR_GET, &fmtenum);
401 while (S_OK == fmtenum->Next(1, &fmtetc, 0)) {
402 #if defined(QMIME_DEBUG) && !defined(Q_OS_WINCE) 403 qDebug(
"QWindowsMime::allMimesForFormats()");
404 wchar_t buf[256] = {0};
405 GetClipboardFormatName(fmtetc.cfFormat, buf, 255);
408 for (
int i=mimes.
size()-1; i>=0; --i) {
416 CoTaskMemFree(fmtetc.ptd);
428 bool canConvertToMime(
const QString &mimeType, IDataObject *pDataObj)
const;
438 int cf =
getCf(formatetc);
439 return (cf == CF_UNICODETEXT || cf == CF_TEXT) && mimeData->
hasText();
449 if (canConvertFromMime(formatetc, mimeData)) {
451 int cf =
getCf(formatetc);
455 int maxsize=data.
size()+data.
size()/40+3;
458 const char*
d = data.
data();
459 const int s = data.
size();
462 for (
int i=0; i<s; i++) {
474 if (j+3 >= maxsize) {
475 maxsize += maxsize/4;
482 }
else if (cf == CF_UNICODETEXT) {
486 const int s = str.
length();
487 int maxsize = s + s/40 + 3;
491 for (
int i=0; i < s; ++i) {
500 if (ri+3 >= maxsize) {
501 maxsize += maxsize/4;
527 int cf =
getCf(formatetc);
528 if (cf == CF_UNICODETEXT || cf == CF_TEXT)
538 formatics +=
setCf(CF_UNICODETEXT);
539 formatics +=
setCf(CF_TEXT);
548 if (canConvertToMime(mime, pDataObj)) {
555 data =
getData(CF_TEXT, pDataObj);
557 const char*
d = data.
data();
562 for (
int i=0; i<s; i++) {
584 bool canConvertToMime(
const QString &mimeType, IDataObject *pDataObj)
const;
605 for (
int i=0; i<urls.
size(); i++) {
615 if (canConvertFromMime(formatetc, mimeData)) {
619 int size =
sizeof(DROPFILES)+2;
620 for (
int i=0; i<urls.
size(); i++) {
629 DROPFILES*
d = (DROPFILES*)result.
data();
630 d->pFiles =
sizeof(DROPFILES);
631 GetCursorPos(&d->pt);
633 char* files = ((
char*)d) + d->pFiles;
636 wchar_t* f = (
wchar_t*)files;
637 for (
int i=0; i<fileNames.
size(); i++) {
645 return setData(result, pmedium);
646 }
else if (
getCf(formatetc) == CF_INETURL_W) {
655 return setData(result, pmedium);
656 }
else if (
getCf(formatetc) == CF_INETURL) {
661 return setData(result, pmedium);
688 if (canConvertFromMime(
setCf(CF_INETURL_W), mimeData))
689 formatics +=
setCf(CF_INETURL_W);
690 if (canConvertFromMime(
setCf(CF_INETURL), mimeData))
691 formatics +=
setCf(CF_INETURL);
707 LPDROPFILES hdrop = (LPDROPFILES)data.
data();
709 const wchar_t* filesw = (
const wchar_t *)(data.
data() + hdrop->pFiles);
717 const char* files = (
const char *)data.
data() + hdrop->pFiles;
721 i += int(strlen(files+i))+1;
729 }
else if (
canGetData(CF_INETURL_W, pDataObj)) {
734 }
else if (
canGetData(CF_INETURL, pDataObj)) {
755 bool canConvertToMime(
const QString &mimeType, IDataObject *pDataObj)
const;
772 formatetcs +=
setCf(CF_HTML);
778 if (
getCf(formatetc) == CF_HTML)
810 if (canConvertToMime(mime, pDataObj)) {
813 qDebug(
"QWindowsMimeHtml::convertToMime");
817 int start = html.
indexOf(
"StartFragment:");
821 int startOffset = start + 14;
823 while (html.
at(i) !=
'\r' && html.
at(i) !=
'\n')
825 QByteArray bytecount = html.
mid(startOffset, i - startOffset);
826 start = bytecount.
toInt();
830 int endOffset = end + 12;
832 while (html.
at(i) !=
'\r' && html.
at(i) !=
'\n')
835 end = bytecount.
toInt();
838 if (end > start && start > 0) {
839 html =
"<!--StartFragment-->" + html.
mid(start, end - start);
840 html +=
"<!--EndFragment-->";
850 if (canConvertFromMime(formatetc, mimeData)) {
854 "StartHTML:0000000105\r\n" 855 "EndHTML:0000000000\r\n" 856 "StartFragment:0000000000\r\n" 857 "EndFragment:0000000000\r\n\r\n";
859 if (data.
indexOf(
"<!--StartFragment-->") == -1)
860 result +=
"<!--StartFragment-->";
862 if (data.
indexOf(
"<!--EndFragment-->") == -1)
863 result +=
"<!--EndFragment-->";
871 memcpy((
char *)(result.
data() + 79 - pos.length()), pos.constData(), pos.length());
873 memcpy((
char *)(result.
data() + 103 - pos.length()), pos.constData(), pos.length());
875 return setData(result, pmedium);
881 #ifndef QT_NO_IMAGEFORMAT_BMP 892 bool canConvertToMime(
const QString &mimeType, IDataObject *pDataObj)
const;
896 bool hasOriginalDIBV5(IDataObject *pDataObj)
const;
902 CF_PNG = RegisterClipboardFormat(L
"PNG");
913 formatetcs +=
setCf(CF_DIB);
920 int cf =
getCf(formatetc);
921 if (cf == CF_DIB || cf ==
CF_DIBV5 || cf ==
int(CF_PNG))
936 int cf =
getCf(formatetc);
952 int cf =
getCf(formatetc);
975 bool isSynthesized =
true;
976 IEnumFORMATETC *pEnum =NULL;
977 HRESULT res = pDataObj->EnumFormatEtc(1, &pEnum);
978 if (res == S_OK && pEnum) {
980 while ((res = pEnum->Next(1, &fc, 0)) == S_OK) {
982 CoTaskMemFree(fc.ptd);
983 if (fc.cfFormat == CF_DIB)
986 isSynthesized =
false;
992 return !isSynthesized;
1041 bool canConvertFromMime(
const FORMATETC &formatetc,
const QMimeData *mimeData)
const;
1046 bool canConvertToMime(
const QString &mimeType, IDataObject *pDataObj)
const;
1065 return formatetc.tymed & TYMED_HGLOBAL
1080 const int s = html.
length();
1081 int maxsize = s + s/40 + 3;
1085 for (
int i=0; i < s; ++i) {
1094 if (ri+3 >= maxsize) {
1095 maxsize += maxsize/4;
1105 r[byteLength+1] = 0;
1108 #ifndef QT_NO_DRAGANDDROP 1110 #endif //QT_NO_DRAGANDDROP 1112 return setData(data, pmedium);
1138 qDebug(
"QBuiltInMimes::convertToMime()");
1184 if (!ianaTypes.size()) {
1196 if (!excludeList.size()) {
1198 excludeList.append(
QLatin1String(
"UniformResourceLocator"));
1202 excludeList.append(
QLatin1String(
"application/x-qt-image"));
1210 #ifndef QT_NO_DRAGANDDROP 1211 return formatetc.tymed & TYMED_HGLOBAL
1212 && (formats.contains(formatetc.cfFormat)
1217 return formatetc.tymed & TYMED_HGLOBAL
1218 && formats.contains(formatetc.cfFormat);
1219 #endif //QT_NO_DRAGANDDROP 1224 #ifndef QT_NO_DRAGANDDROP 1232 #endif //QT_NO_DRAGANDDROP 1238 if (!formats.keys(mimeType).isEmpty()) {
1239 formatetcs +=
setCf(formats.key(mimeType));
1245 formatetcs +=
setCf(cf);
1260 return mimeType.
mid(len, n);
1267 int cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.
utf16()));
1269 }
else if (formats.keys(mimeType).isEmpty()) {
1274 return canGetData(formats.key(mimeType), pDataObj);
1287 int cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.
utf16()));
1289 }
else if (formats.keys(mimeType).isEmpty()) {
1293 data =
getData(formats.key(mimeType), pDataObj);
1307 wchar_t buffer[256];
1308 int len = GetClipboardFormatName(
getCf(formatetc), buffer, 256);
1312 #ifndef QT_NO_DRAGANDDROP 1314 format = clipFormat;
1315 else if((formatetc.cfFormat >= 0xC000)){
1319 bool ianaType =
false;
1320 int sz = ianaTypes.
size();
1321 for (
int i = 0; i < sz; i++) {
1330 format = clipFormat;
1333 #endif //QT_NO_DRAGANDDROP 1340 : initialized(false)
1355 #ifndef QT_NO_IMAGEFORMAT_BMP 1385 #ifndef QT_NO_IMAGEFORMAT_BMP 1393 int bpl_bmp = image.
width()*4;
1414 d->
write(reinterpret_cast<const char*>(&bi), bi.
bV5Size);
1418 DWORD colorSpace[3] = {0x00ff0000,0x0000ff00,0x000000ff};
1419 d->
write(reinterpret_cast<const char*>(colorSpace),
sizeof(colorSpace));
1429 memset(buf, 0, bpl_bmp);
1430 for (
int y=image.
height()-1; y>=0; y--) {
1450 d->
write((
char*)buf, bpl_bmp);
1463 while (!(mask & 1)) {
1478 d->
read((
char *)&bi,
sizeof(bi));
1482 int nbits = bi.bV5BitCount;
1483 int comp = bi.bV5Compression;
1484 if (nbits != 32 || bi.bV5Planes != 1 || comp !=
BMP_BITFIELDS)
1487 int w = bi.bV5Width, h = bi.bV5Height;
1488 int red_mask = bi.bV5RedMask;
1489 int green_mask = bi.bV5GreenMask;
1490 int blue_mask = bi.bV5BlueMask;
1491 int alpha_mask = bi.bV5AlphaMask;
1493 int green_shift = 0;
1495 int alpha_shift = 0;
1498 if (bi.bV5Height < 0)
1501 image =
QImage(w, h, format);
1508 DWORD colorSpace[3];
1509 if (d->
read((
char *)colorSpace,
sizeof(colorSpace)) !=
sizeof(colorSpace))
1524 int bpl24 = ((w*nbits+31)/32)*4;
1529 p = (
QRgb *)(data + h*bpl);
1531 if (d->
read((
char *)buf24,bpl24) != bpl24)
1535 c = *b | (*(b+1))<<8 | (*(b+2))<<16 | (*(b+3))<<24;
1536 *p++ =
qRgba(((c & red_mask) >> red_shift) ,
1537 ((c & green_mask) >> green_shift),
1538 ((c & blue_mask) >> blue_shift),
1539 ((c & alpha_mask) >> alpha_shift));
1545 if (bi.bV5Height < 0) {
1549 for (
int y = 0; y < h/2; ++y) {
1550 memcpy(buf, data + y*bpl, bpl);
1551 memcpy(data + y*bpl, data + (h-y-1)*bpl, bpl);
1552 memcpy(data + (h-y-1)*bpl, buf, bpl);
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVariant class acts like a union for the most common Qt data types.
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
The QWindowsMime class maps open-standard MIME to Window Clipboard formats.
Status status() const
Returns the status of the data stream.
bool qt_write_dib(QDataStream &, QImage)
static QString customMimeType(const QString &mimeType)
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
Returns true if the converter can convert from the mimeData to the format specified in formatetc...
Format
The following image formats are available in Qt.
virtual ~QWindowsMime()
Destroys a conversion object, removing it from the global list of available converters.
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
static int getCf(const FORMATETC &formatetc)
#define QT_END_NAMESPACE
This macro expands to.
virtual QStringList formats() const
Returns a list of formats supported by the object.
const Key key(const T &value) const
Returns the first key with value value.
char * data()
Returns a pointer to the data stored in the byte array.
QVector< FORMATETC > formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that c...
bool isWritable() const
Returns true if data can be written to the device; otherwise returns false.
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
static QStringList excludeList
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
QByteArray & append(char c)
Appends the character ch to this byte array.
static QStringList allMimesForFormats(IDataObject *pDataObj)
static bool qt_write_dibv5(QDataStream &s, QImage image)
QMap< int, QString > inFormats
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
QString & replace(int i, int len, QChar after)
The QByteArray class provides an array of bytes.
static QStringList ianaTypes
static QStringList formatsHelper(const QMimeData *data)
int length() const
Returns the number of characters in this string.
#define BMP_LCS_GM_IMAGES
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static bool isCustomMimeType(const QString &mimeType)
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int bytesPerLine() const
Returns the number of bytes per image scanline.
struct tagFORMATETC FORMATETC
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
Returns true if the converter can convert to the mimeType from the available formats in pDataObj...
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
Returns true if the converter can convert to the mimeType from the available formats in pDataObj...
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
QString mimeForFormat(const FORMATETC &formatetc) const
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.
The QVector class is a template class that provides a dynamic array.
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
QList< QWindowsMime * > mimes
The QChar class provides a 16-bit Unicode character.
Format format() const
Returns the format of the image.
QVector< FORMATETC > formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that c...
QWindowsMime()
Constructs a new conversion object, adding it to the globally accessed list of available converters...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
Returns true if the converter can convert to the mimeType from the available formats in pDataObj...
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
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 c...
Q_CORE_EXPORT void qDebug(const char *,...)
QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const
Returns a QVariant containing the converted data for mimeType from pDataObj.
QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const
Returns a QVariant containing the converted data for mimeType from pDataObj.
bool hasOriginalDIBV5(IDataObject *pDataObj) const
void append(const T &t)
Inserts value at the end of the list.
static FORMATETC setCf(int cf)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QMap< int, QString > outFormats
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
bool qt_read_dib(QDataStream &, QImage &)
void truncate(int pos)
Truncates the string at the given position index.
QString text() const
Returns a plain text (MIME type text/plain) representation of the data.
int size() const
Returns the number of characters in this string.
const QChar * unicode() const
Returns a '\0'-terminated Unicode representation of the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static bool setData(const QByteArray &data, STGMEDIUM *pmedium)
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
Returns true if the converter can convert from the mimeData to the format specified in formatetc...
QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const
Returns a QVariant containing the converted data for mimeType from pDataObj.
const T value(const Key &key) const
Returns the value associated with the key key.
const T & at(int i) const
Returns the item at index position i in the list.
QString html() const
Returns a string if the data stored in the object is HTML (MIME type text/html); otherwise returns an...
The QStringList class provides a list of strings.
static QByteArray fromRawData(const char *, int size)
Constructs a QByteArray that uses the first size bytes of the data array.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
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.
The QImage class provides a hardware-independent image representation that allows direct access to th...
QVector< FORMATETC > formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that c...
static const char * data(const QByteArray &arr)
static bool hasFormatHelper(const QString &mimeType, const QMimeData *data)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QString mimeForFormat(const FORMATETC &formatetc) const
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.
Type
This enum type defines the types of variable that a QVariant can contain.
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
Returns true if the converter can convert from the mimeData to the format specified in formatetc...
struct tagSTGMEDIUM STGMEDIUM
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
QList< QUrl > urls() const
Returns a list of URLs contained within the MIME data object.
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
Returns true if the converter can convert to the mimeType from the available formats in pDataObj...
void setByteOrder(ByteOrder)
Sets the serialization byte order to bo.
QList< Key > keys() const
Returns a list containing all the keys in the map in ascending order.
void setDotsPerMeterY(int)
Sets the number of pixels that fit vertically in a physical meter, to y.
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
Returns true if the converter can convert to the mimeType from the available formats in pDataObj...
The QMimeData class provides a container for data that records information about its MIME type...
QByteArray mid(int index, int len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos...
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
static int calc_shift(int mask)
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data)
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const
Convert the mimeData to the format specified in formatetc.
static bool canReadData(const QString &mimeType)
QSize size() const
Returns the size of the image, i.
int length() const
Same as size().
void resize(int size)
Sets the size of the string to size characters.
T & first()
Returns a reference to the first item in the list.
void addWindowsMime(QWindowsMime *mime)
const char * constData() const
Returns a pointer to the data stored in the byte array.
QVariant imageData() const
Returns a QVariant storing a QImage if the object can return an image; otherwise returns a null varia...
bool hasImage() const
Returns true if the object can return an image; otherwise returns false.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Q_GLOBAL_STATIC(QWindowsMimeList, theMimeList)
virtual bool hasFormat(const QString &mimetype) const
Returns true if the object can return data for the MIME type specified by mimeType; otherwise returns...
uchar * bits()
Returns a pointer to the first pixel data.
QVector< FORMATETC > formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that c...
QString mimeForFormat(const FORMATETC &formatetc) const
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.
uint qstrlen(const char *str)
bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const
Returns true if the converter can convert to the mimeType from the available formats in pDataObj...
int width() const
Returns the width of the image.
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const
Convert the mimeData to the format specified in formatetc.
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
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...
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const
Convert the mimeData to the format specified in formatetc.
static QWindowsMime * converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData)
QIODevice * device() const
Returns the I/O device currently set, or 0 if no device is currently set.
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const
Convert the mimeData to the format specified in formatetc.
static int registerMimeType(const QString &mime)
Registers the MIME type mime, and returns an ID number identifying the format on Windows.
void setDotsPerMeterX(int)
Sets the number of pixels that fit horizontally in a physical meter, to x.
QVector< FORMATETC > formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that c...
QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const
Returns a QVariant containing the converted data for mimeType from pDataObj.
QList< QWindowsMime * > windowsMimes()
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
bool hasText() const
Returns true if the object can return plain text (MIME type text/plain); otherwise returns false...
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...
void resize(int size)
Sets the size of the byte array to size bytes.
int size() const
Returns the number of items in the list.
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const
Convert the mimeData to the format specified in formatetc.
static const char x_qt_windows_mime[]
static QWindowsMime * converterToMime(const QString &mimeType, IDataObject *pDataObj)
bool contains(const Key &key) const
Returns true if the map contains an item with key key; otherwise returns false.
int height() const
Returns the height of the image.
T qvariant_cast(const QVariant &)
int size() const
Returns the number of bytes in this byte array.
static const int BMP_BITFIELDS
QVector< FORMATETC > formatsForMime(const QString &mimeType, const QMimeData *mimeData) const
Returns a QVector of FORMATETC structures representing the different windows clipboard formats that c...
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
Returns true if the converter can convert from the mimeData to the format specified in formatetc...
void removeWindowsMime(QWindowsMime *mime)
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QByteArray & replace(int index, int len, const char *s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QSize class defines the size of a two-dimensional object using integer point precision.
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
Returns true if the converter can convert from the mimeData to the format specified in formatetc...
The QDataStream class provides serialization of binary data to a QIODevice.
void reserve(int size)
Attempts to allocate memory for at least size elements.
QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const
QString mimeForFormat(const FORMATETC &formatetc) const
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.
QMap< int, QString > formats
bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
Returns true if the converter can convert from the mimeData to the format specified in formatetc...
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const
Convert the mimeData to the format specified in formatetc.
char at(int i) const
Returns the character at index position i in the byte array.
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
static QString toNativeSeparators(const QString &pathName)
Returns pathName with the '/' separators converted to separators that are appropriate for the underly...
QString mimeForFormat(const FORMATETC &formatetc) const
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.
QString mimeForFormat(const FORMATETC &formatetc) const
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.
static QVector< FORMATETC > allFormatsForMime(const QMimeData *mimeData)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
static QByteArray getData(int cf, IDataObject *pDataObj)
bool loadFromData(const uchar *buf, int len, const char *format=0)
Loads an image from the first len bytes of the given binary data.
static bool canGetData(int cf, IDataObject *pDataObj)
The QList class is a template class that provides lists.
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
void qErrnoWarning(const char *msg,...)
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
static bool qt_read_dibv5(QDataStream &s, QImage &image)