Qt 4.8
Classes | Macros | Functions | Variables
qmime_win.cpp File Reference
#include "qmime.h"
#include "qimagereader.h"
#include "qimagewriter.h"
#include "qdatastream.h"
#include "qbuffer.h"
#include "qt_windows.h"
#include "qapplication_p.h"
#include "qtextcodec.h"
#include "qregexp.h"
#include "qalgorithms.h"
#include "qmap.h"
#include "qdnd_p.h"
#include <shlobj.h>
#include "qurl.h"
#include "qvariant.h"
#include "qtextdocument.h"
#include "qdir.h"
#include "qguifunctions_wince.h"

Go to the source code of this file.

Classes

struct  _CIEXYZ
 
struct  _CIEXYZTRIPLE
 
struct  BMP_BITMAPV5HEADER
 
class  QBuiltInMimes
 
class  QLastResortMimes
 
class  QWindowsMimeHtml
 
class  QWindowsMimeImage
 
class  QWindowsMimeList
 
class  QWindowsMimeText
 
class  QWindowsMimeURI
 

Macros

#define BMP_LCS_GM_IMAGES   0x00000004L
 
#define BMP_LCS_sRGB   0x73524742
 
#define CF_DIBV5   17
 

Functions

static int calc_shift (int mask)
 
static bool canGetData (int cf, IDataObject *pDataObj)
 
static QString customMimeType (const QString &mimeType)
 
static int getCf (const FORMATETC &formatetc)
 
static QByteArray getData (int cf, IDataObject *pDataObj)
 
static bool isCustomMimeType (const QString &mimeType)
 
 Q_GLOBAL_STATIC (QWindowsMimeList, theMimeList)
 
bool qt_read_dib (QDataStream &, QImage &)
 
static bool qt_read_dibv5 (QDataStream &s, QImage &image)
 
bool qt_write_dib (QDataStream &, QImage)
 
static bool qt_write_dibv5 (QDataStream &s, QImage image)
 
static FORMATETC setCf (int cf)
 
static bool setData (const QByteArray &data, STGMEDIUM *pmedium)
 

Variables

static const int BMP_BITFIELDS = 3
 
static const char x_qt_windows_mime [] = "application/x-qt-windows-mime;value=\""
 

Macro Definition Documentation

◆ BMP_LCS_GM_IMAGES

#define BMP_LCS_GM_IMAGES   0x00000004L

Definition at line 76 of file qmime_win.cpp.

Referenced by qt_write_dibv5().

◆ BMP_LCS_sRGB

#define BMP_LCS_sRGB   0x73524742

Definition at line 75 of file qmime_win.cpp.

Referenced by qt_write_dibv5().

◆ CF_DIBV5

#define CF_DIBV5   17

Function Documentation

◆ calc_shift()

static int calc_shift ( int  mask)
static

Definition at line 1460 of file qmime_win.cpp.

Referenced by qt_read_dibv5().

1461 {
1462  int result = 0;
1463  while (!(mask & 1)) {
1464  result++;
1465  mask >>= 1;
1466  }
1467  return result;
1468 }

◆ canGetData()

static bool canGetData ( int  cf,
IDataObject *  pDataObj 
)
static

Definition at line 191 of file qmime_win.cpp.

Referenced by QWindowsMimeText::canConvertToMime(), QWindowsMimeURI::canConvertToMime(), QWindowsMimeHtml::canConvertToMime(), QWindowsMimeImage::canConvertToMime(), QBuiltInMimes::canConvertToMime(), QLastResortMimes::canConvertToMime(), QWindowsMimeURI::convertToMime(), and QWindowsMimeImage::convertToMime().

192 {
193  FORMATETC formatetc = setCf(cf);
194  if (pDataObj->QueryGetData(&formatetc) != S_OK){
195  formatetc.tymed = TYMED_ISTREAM;
196  return pDataObj->QueryGetData(&formatetc) == S_OK;
197  }
198  return true;
199 }
struct tagFORMATETC FORMATETC
Definition: qmime.h:66
static FORMATETC setCf(int cf)
Definition: qmime_win.cpp:130

◆ customMimeType()

static QString customMimeType ( const QString mimeType)
static

Definition at line 1256 of file qmime_win.cpp.

Referenced by QLastResortMimes::canConvertToMime(), and QLastResortMimes::convertToMime().

1257 {
1258  int len = sizeof(x_qt_windows_mime) - 1;
1259  int n = mimeType.lastIndexOf(QLatin1Char('\"'))-len;
1260  return mimeType.mid(len, n);
1261 }
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...
Definition: qstring.cpp:3706
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
static const char x_qt_windows_mime[]
Definition: qmime_win.cpp:1249
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ getCf()

static int getCf ( const FORMATETC formatetc)
static

◆ getData()

static QByteArray getData ( int  cf,
IDataObject *  pDataObj 
)
static

Definition at line 156 of file qmime_win.cpp.

Referenced by QWindowsMimeText::convertToMime(), QWindowsMimeURI::convertToMime(), QWindowsMimeHtml::convertToMime(), QWindowsMimeImage::convertToMime(), QBuiltInMimes::convertToMime(), and QLastResortMimes::convertToMime().

157 {
159  FORMATETC formatetc = setCf(cf);
160  STGMEDIUM s;
161  if (pDataObj->GetData(&formatetc, &s) == S_OK) {
162  DWORD * val = (DWORD*)GlobalLock(s.hGlobal);
163  data = QByteArray::fromRawData((char*)val, GlobalSize(s.hGlobal));
164  data.detach();
165  GlobalUnlock(s.hGlobal);
166  ReleaseStgMedium(&s);
167  } else {
168  //Try reading IStream data
169  formatetc.tymed = TYMED_ISTREAM;
170  if (pDataObj->GetData(&formatetc, &s) == S_OK) {
171  char szBuffer[4096];
172  ULONG actualRead = 0;
173  LARGE_INTEGER pos = {{0, 0}};
174  //Move to front (can fail depending on the data model implemented)
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) {
179  data += QByteArray::fromRawData(szBuffer, actualRead);
180  }
181  if (actualRead != sizeof(szBuffer))
182  break;
183  }
184  data.detach();
185  ReleaseStgMedium(&s);
186  }
187  }
188  return data;
189 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
struct tagFORMATETC FORMATETC
Definition: qmime.h:66
static FORMATETC setCf(int cf)
Definition: qmime_win.cpp:130
static QByteArray fromRawData(const char *, int size)
Constructs a QByteArray that uses the first size bytes of the data array.
static const char * data(const QByteArray &arr)
struct tagSTGMEDIUM STGMEDIUM
Definition: qmime.h:67
long HRESULT
void detach()
Definition: qbytearray.h:435

◆ isCustomMimeType()

static bool isCustomMimeType ( const QString mimeType)
static

Definition at line 1251 of file qmime_win.cpp.

Referenced by QLastResortMimes::canConvertToMime(), and QLastResortMimes::convertToMime().

1252 {
1254 }
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static const char x_qt_windows_mime[]
Definition: qmime_win.cpp:1249

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( QWindowsMimeList  ,
theMimeList   
)

◆ qt_read_dib()

bool qt_read_dib ( QDataStream ,
QImage  
)

Definition at line 685 of file qbmphandler.cpp.

Referenced by QWindowsMimeImage::convertToMime().

686 {
687  BMP_INFOHDR bi;
688  if (!read_dib_infoheader(s, bi))
689  return false;
690  return read_dib_body(s, bi, -1, -BMP_FILEHDR_SIZE, image);
691 }
static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int startpos, QImage &image)
const int BMP_FILEHDR_SIZE
Definition: qbmphandler.cpp:82
static bool read_dib_infoheader(QDataStream &s, BMP_INFOHDR &bi)

◆ qt_read_dibv5()

static bool qt_read_dibv5 ( QDataStream s,
QImage image 
)
static

Definition at line 1471 of file qmime_win.cpp.

Referenced by QWindowsMimeImage::convertToMime().

1472 {
1473  BMP_BITMAPV5HEADER bi;
1474  QIODevice* d = s.device();
1475  if (d->atEnd())
1476  return false;
1477 
1478  d->read((char *)&bi, sizeof(bi)); // read BITMAPV5HEADER header
1479  if (s.status() != QDataStream::Ok)
1480  return false;
1481 
1482  int nbits = bi.bV5BitCount;
1483  int comp = bi.bV5Compression;
1484  if (nbits != 32 || bi.bV5Planes != 1 || comp != BMP_BITFIELDS)
1485  return false; //Unsupported DIBV5 format
1486 
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;
1492  int red_shift = 0;
1493  int green_shift = 0;
1494  int blue_shift = 0;
1495  int alpha_shift = 0;
1497 
1498  if (bi.bV5Height < 0)
1499  h = -h; // support images with negative height
1500  if (image.size() != QSize(w, h) || image.format() != format) {
1501  image = QImage(w, h, format);
1502  if (image.isNull()) // could not create image
1503  return false;
1504  }
1505  image.setDotsPerMeterX(bi.bV5XPelsPerMeter);
1506  image.setDotsPerMeterY(bi.bV5YPelsPerMeter);
1507  // read color table
1508  DWORD colorSpace[3];
1509  if (d->read((char *)colorSpace, sizeof(colorSpace)) != sizeof(colorSpace))
1510  return false;
1511 
1512  red_shift = calc_shift(red_mask);
1513  green_shift = calc_shift(green_mask);
1514  blue_shift = calc_shift(blue_mask);
1515  if (alpha_mask) {
1516  alpha_shift = calc_shift(alpha_mask);
1517  }
1518 
1519  int bpl = image.bytesPerLine();
1520  uchar *data = image.bits();
1521  register QRgb *p;
1522  QRgb *end;
1523  uchar *buf24 = new uchar[bpl];
1524  int bpl24 = ((w*nbits+31)/32)*4;
1525  uchar *b;
1526  unsigned int c;
1527 
1528  while (--h >= 0) {
1529  p = (QRgb *)(data + h*bpl);
1530  end = p + w;
1531  if (d->read((char *)buf24,bpl24) != bpl24)
1532  break;
1533  b = buf24;
1534  while (p < end) {
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));
1540  b += 4;
1541  }
1542  }
1543  delete[] buf24;
1544 
1545  if (bi.bV5Height < 0) {
1546  // Flip the image
1547  uchar *buf = new uchar[bpl];
1548  h = -bi.bV5Height;
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);
1553  }
1554  delete [] buf;
1555  }
1556 
1557  return true;
1558 }
double d
Definition: qnumeric_p.h:62
Status status() const
Returns the status of the data stream.
Format
The following image formats are available in Qt.
Definition: qimage.h:91
unsigned int QRgb
Definition: qrgb.h:53
unsigned char c[8]
Definition: qnumeric_p.h:62
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
Definition: qiodevice.cpp:711
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
Definition: qiodevice.cpp:791
unsigned char uchar
Definition: qglobal.h:994
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static const char * data(const QByteArray &arr)
void setDotsPerMeterY(int)
Sets the number of pixels that fit vertically in a physical meter, to y.
Definition: qimage.cpp:5667
static int calc_shift(int mask)
Definition: qmime_win.cpp:1460
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
QIODevice * device() const
Returns the I/O device currently set, or 0 if no device is currently set.
Definition: qdatastream.h:206
void setDotsPerMeterX(int)
Sets the number of pixels that fit horizontally in a physical meter, to x.
Definition: qimage.cpp:5645
static const int BMP_BITFIELDS
Definition: qmime_win.cpp:112
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
QRgb qRgba(int r, int g, int b, int a)
Returns the ARGB quadruplet ({a}, {r}, {g}, {b}).
Definition: qrgb.h:72

◆ qt_write_dib()

bool qt_write_dib ( QDataStream ,
QImage   
)

Definition at line 565 of file qbmphandler.cpp.

Referenced by QWindowsMimeImage::convertFromMime(), and QBmpHandler::write().

566 {
567  int nbits;
568  int bpl_bmp;
569  int bpl = image.bytesPerLine();
570 
571  QIODevice* d = s.device();
572  if (!d->isWritable())
573  return false;
574 
575  if (image.depth() == 8 && image.colorCount() <= 16) {
576  bpl_bmp = (((bpl+1)/2+3)/4)*4;
577  nbits = 4;
578  } else if (image.depth() == 32) {
579  bpl_bmp = ((image.width()*24+31)/32)*4;
580  nbits = 24;
581 #ifdef Q_WS_QWS
582  } else if (image.depth() == 1 || image.depth() == 8) {
583  // Qt for Embedded Linux doesn't word align.
584  bpl_bmp = ((image.width()*image.depth()+31)/32)*4;
585  nbits = image.depth();
586 #endif
587  } else {
588  bpl_bmp = bpl;
589  nbits = image.depth();
590  }
591 
592  BMP_INFOHDR bi;
593  bi.biSize = BMP_WIN; // build info header
594  bi.biWidth = image.width();
595  bi.biHeight = image.height();
596  bi.biPlanes = 1;
597  bi.biBitCount = nbits;
598  bi.biCompression = BMP_RGB;
599  bi.biSizeImage = bpl_bmp*image.height();
600  bi.biXPelsPerMeter = image.dotsPerMeterX() ? image.dotsPerMeterX()
601  : 2834; // 72 dpi default
602  bi.biYPelsPerMeter = image.dotsPerMeterY() ? image.dotsPerMeterY() : 2834;
603  bi.biClrUsed = image.colorCount();
604  bi.biClrImportant = image.colorCount();
605  s << bi; // write info header
606  if (s.status() != QDataStream::Ok)
607  return false;
608 
609  if (image.depth() != 32) { // write color table
610  uchar *color_table = new uchar[4*image.colorCount()];
611  uchar *rgb = color_table;
612  QVector<QRgb> c = image.colorTable();
613  for (int i=0; i<image.colorCount(); i++) {
614  *rgb++ = qBlue (c[i]);
615  *rgb++ = qGreen(c[i]);
616  *rgb++ = qRed (c[i]);
617  *rgb++ = 0;
618  }
619  if (d->write((char *)color_table, 4*image.colorCount()) == -1) {
620  delete [] color_table;
621  return false;
622  }
623  delete [] color_table;
624  }
625 
626  if (image.format() == QImage::Format_MonoLSB)
627  image = image.convertToFormat(QImage::Format_Mono);
628 
629  int y;
630 
631  if (nbits == 1 || nbits == 8) { // direct output
632 #ifdef Q_WS_QWS
633  // Qt for Embedded Linux doesn't word align.
634  int pad = bpl_bmp - bpl;
635  char padding[4];
636 #endif
637  for (y=image.height()-1; y>=0; y--) {
638  if (d->write((char*)image.scanLine(y), bpl) == -1)
639  return false;
640 #ifdef Q_WS_QWS
641  if (d->write(padding, pad) == -1)
642  return false;
643 #endif
644  }
645  return true;
646  }
647 
648  uchar *buf = new uchar[bpl_bmp];
649  uchar *b, *end;
650  register uchar *p;
651 
652  memset(buf, 0, bpl_bmp);
653  for (y=image.height()-1; y>=0; y--) { // write the image bits
654  if (nbits == 4) { // convert 8 -> 4 bits
655  p = image.scanLine(y);
656  b = buf;
657  end = b + image.width()/2;
658  while (b < end) {
659  *b++ = (*p << 4) | (*(p+1) & 0x0f);
660  p += 2;
661  }
662  if (image.width() & 1)
663  *b = *p << 4;
664  } else { // 32 bits
665  QRgb *p = (QRgb *)image.scanLine(y);
666  QRgb *end = p + image.width();
667  b = buf;
668  while (p < end) {
669  *b++ = qBlue(*p);
670  *b++ = qGreen(*p);
671  *b++ = qRed(*p);
672  p++;
673  }
674  }
675  if (bpl_bmp != d->write((char*)buf, bpl_bmp)) {
676  delete[] buf;
677  return false;
678  }
679  }
680  delete[] buf;
681  return true;
682 }
double d
Definition: qnumeric_p.h:62
const int BMP_WIN
unsigned int QRgb
Definition: qrgb.h:53
unsigned char c[8]
Definition: qnumeric_p.h:62
bool isWritable() const
Returns true if data can be written to the device; otherwise returns false.
Definition: qiodevice.cpp:558
qint32 biSize
Definition: qbmphandler_p.h:71
int qRed(QRgb rgb)
Returns the red component of the ARGB quadruplet rgb.
Definition: qrgb.h:57
qint32 biSizeImage
Definition: qbmphandler_p.h:77
qint32 biClrUsed
Definition: qbmphandler_p.h:80
qint32 biWidth
Definition: qbmphandler_p.h:72
const int BMP_RGB
unsigned char uchar
Definition: qglobal.h:994
qint32 biYPelsPerMeter
Definition: qbmphandler_p.h:79
qint16 biBitCount
Definition: qbmphandler_p.h:75
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
qint32 biCompression
Definition: qbmphandler_p.h:76
qint32 biClrImportant
Definition: qbmphandler_p.h:81
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
Definition: qiodevice.cpp:1342
int qGreen(QRgb rgb)
Returns the green component of the ARGB quadruplet rgb.
Definition: qrgb.h:60
int qBlue(QRgb rgb)
Returns the blue component of the ARGB quadruplet rgb.
Definition: qrgb.h:63
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
qint32 biXPelsPerMeter
Definition: qbmphandler_p.h:78
qint16 biPlanes
Definition: qbmphandler_p.h:74
qint32 biHeight
Definition: qbmphandler_p.h:73

◆ qt_write_dibv5()

static bool qt_write_dibv5 ( QDataStream s,
QImage  image 
)
static

Definition at line 1386 of file qmime_win.cpp.

Referenced by QWindowsMimeImage::convertFromMime().

1387 {
1388  QIODevice* d = s.device();
1389  if (!d->isWritable())
1390  return false;
1391 
1392  //depth will be always 32
1393  int bpl_bmp = image.width()*4;
1394 
1395  BMP_BITMAPV5HEADER bi ={0};
1396  bi.bV5Size = sizeof(BMP_BITMAPV5HEADER);
1397  bi.bV5Width = image.width();
1398  bi.bV5Height = image.height();
1399  bi.bV5Planes = 1;
1400  bi.bV5BitCount = 32;
1401  bi.bV5Compression = BI_BITFIELDS;
1402  bi.bV5SizeImage = bpl_bmp*image.height();
1403  bi.bV5XPelsPerMeter = 0;
1404  bi.bV5YPelsPerMeter = 0;
1405  bi.bV5ClrUsed = 0;
1406  bi.bV5ClrImportant = 0;
1407  bi.bV5BlueMask = 0x000000ff;
1408  bi.bV5GreenMask = 0x0000ff00;
1409  bi.bV5RedMask = 0x00ff0000;
1410  bi.bV5AlphaMask = 0xff000000;
1411  bi.bV5CSType = BMP_LCS_sRGB; //LCS_sRGB
1412  bi.bV5Intent = BMP_LCS_GM_IMAGES; //LCS_GM_IMAGES
1413 
1414  d->write(reinterpret_cast<const char*>(&bi), bi.bV5Size);
1415  if (s.status() != QDataStream::Ok)
1416  return false;
1417 
1418  DWORD colorSpace[3] = {0x00ff0000,0x0000ff00,0x000000ff};
1419  d->write(reinterpret_cast<const char*>(colorSpace), sizeof(colorSpace));
1420  if (s.status() != QDataStream::Ok)
1421  return false;
1422 
1423  if (image.format() != QImage::Format_ARGB32)
1424  image = image.convertToFormat(QImage::Format_ARGB32);
1425 
1426  uchar *buf = new uchar[bpl_bmp];
1427  uchar *b;
1428 
1429  memset(buf, 0, bpl_bmp);
1430  for (int y=image.height()-1; y>=0; y--) {
1431  // write the image bits
1432  QRgb *p = (QRgb *)image.scanLine(y);
1433  QRgb *end = p + image.width();
1434  b = buf;
1435  while (p < end) {
1436  int alpha = qAlpha(*p);
1437  if (alpha) {
1438  *b++ = qBlue(*p);
1439  *b++ = qGreen(*p);
1440  *b++ = qRed(*p);
1441  } else {
1442  //white for fully transparent pixels.
1443  *b++ = 0xff;
1444  *b++ = 0xff;
1445  *b++ = 0xff;
1446  }
1447  *b++ = alpha;
1448  p++;
1449  }
1450  d->write((char*)buf, bpl_bmp);
1451  if (s.status() != QDataStream::Ok) {
1452  delete[] buf;
1453  return false;
1454  }
1455  }
1456  delete[] buf;
1457  return true;
1458 }
double d
Definition: qnumeric_p.h:62
Status status() const
Returns the status of the data stream.
unsigned int QRgb
Definition: qrgb.h:53
bool isWritable() const
Returns true if data can be written to the device; otherwise returns false.
Definition: qiodevice.cpp:558
#define BMP_LCS_GM_IMAGES
Definition: qmime_win.cpp:76
int qRed(QRgb rgb)
Returns the red component of the ARGB quadruplet rgb.
Definition: qrgb.h:57
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
int qAlpha(QRgb rgba)
Returns the alpha component of the ARGB quadruplet rgba.
Definition: qrgb.h:66
unsigned char uchar
Definition: qglobal.h:994
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
Definition: qimage.cpp:3966
QIODevice * device() const
Returns the I/O device currently set, or 0 if no device is currently set.
Definition: qdatastream.h:206
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
Definition: qiodevice.cpp:1342
int qGreen(QRgb rgb)
Returns the green component of the ARGB quadruplet rgb.
Definition: qrgb.h:60
int qBlue(QRgb rgb)
Returns the blue component of the ARGB quadruplet rgb.
Definition: qrgb.h:63
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
#define BMP_LCS_sRGB
Definition: qmime_win.cpp:75
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886

◆ setCf()

static FORMATETC setCf ( int  cf)
static

Definition at line 130 of file qmime_win.cpp.

Referenced by canGetData(), QWindowsMimeText::formatsForMime(), QWindowsMimeURI::formatsForMime(), QWindowsMimeHtml::formatsForMime(), QWindowsMimeImage::formatsForMime(), QBuiltInMimes::formatsForMime(), QLastResortMimes::formatsForMime(), and getData().

131 {
132  FORMATETC formatetc;
133  formatetc.cfFormat = cf;
134  formatetc.dwAspect = DVASPECT_CONTENT;
135  formatetc.lindex = -1;
136  formatetc.ptd = NULL;
137  formatetc.tymed = TYMED_HGLOBAL;
138  return formatetc;
139 }
struct tagFORMATETC FORMATETC
Definition: qmime.h:66

◆ setData()

static bool setData ( const QByteArray data,
STGMEDIUM pmedium 
)
static

Definition at line 141 of file qmime_win.cpp.

Referenced by QWindowsMimeText::convertFromMime(), QWindowsMimeURI::convertFromMime(), QWindowsMimeHtml::convertFromMime(), QWindowsMimeImage::convertFromMime(), QBuiltInMimes::convertFromMime(), QLastResortMimes::convertFromMime(), QWSProtocolItem::copyFrom(), QXmlInputSource::fetchData(), QXmlInputSource::init(), QWSProtocolItem::read(), QStandardItem::setAccessibleDescription(), QStandardItem::setAccessibleText(), QStandardItem::setBackground(), QListWidgetItem::setBackground(), QTableWidgetItem::setBackground(), QTreeWidgetItem::setBackground(), QListWidgetItem::setBackgroundColor(), QTableWidgetItem::setBackgroundColor(), QTreeWidgetItem::setBackgroundColor(), QStandardItem::setCheckState(), QListWidgetItem::setCheckState(), QTableWidgetItem::setCheckState(), QTreeWidgetItem::setCheckState(), QBuffer::setData(), QXmlInputSource::setData(), QListWidgetItem::setFont(), QStandardItem::setFont(), QTableWidgetItem::setFont(), QTreeWidgetItem::setFont(), QStandardItem::setForeground(), QListWidgetItem::setForeground(), QTableWidgetItem::setForeground(), QTreeWidgetItem::setForeground(), QStandardItem::setIcon(), QListWidgetItem::setIcon(), QTableWidgetItem::setIcon(), QTreeWidgetItem::setIcon(), QClipboard::setPixmap(), QStandardItem::setSizeHint(), QListWidgetItem::setSizeHint(), QTableWidgetItem::setSizeHint(), QTreeWidgetItem::setSizeHint(), QStandardItem::setStatusTip(), QListWidgetItem::setStatusTip(), QTableWidgetItem::setStatusTip(), QTreeWidgetItem::setStatusTip(), QStandardItem::setText(), QListWidgetItem::setText(), QTableWidgetItem::setText(), QTreeWidgetItem::setText(), QAccessibleItemRow::setText(), QListWidgetItem::setTextAlignment(), QStandardItem::setTextAlignment(), QTableWidgetItem::setTextAlignment(), QTreeWidgetItem::setTextAlignment(), QListWidgetItem::setTextColor(), QTableWidgetItem::setTextColor(), QTreeWidgetItem::setTextColor(), QStandardItem::setToolTip(), QListWidgetItem::setToolTip(), QTableWidgetItem::setToolTip(), QTreeWidgetItem::setToolTip(), QGraphicsItem::setTransformOriginPoint(), QStandardItem::setWhatsThis(), QListWidgetItem::setWhatsThis(), QTableWidgetItem::setWhatsThis(), QTreeWidgetItem::setWhatsThis(), and QAbstractItemModel::sibling().

142 {
143  HGLOBAL hData = GlobalAlloc(0, data.size());
144  if (!hData)
145  return false;
146 
147  void *out = GlobalLock(hData);
148  memcpy(out, data.data(), data.size());
149  GlobalUnlock(hData);
150  pmedium->tymed = TYMED_HGLOBAL;
151  pmedium->hGlobal = hData;
152  pmedium->pUnkForRelease = 0;
153  return true;
154 }
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402

Variable Documentation

◆ BMP_BITFIELDS

const int BMP_BITFIELDS = 3
static

Definition at line 112 of file qmime_win.cpp.

Referenced by qt_read_dibv5().

◆ x_qt_windows_mime

const char x_qt_windows_mime[] = "application/x-qt-windows-mime;value=\""
static