Qt 4.8
qdnd.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qplatformdefs.h"
43 
44 #include "qbitmap.h"
45 #include "qdrag.h"
46 #include "qpixmap.h"
47 #include "qevent.h"
48 #include "qfile.h"
49 #include "qtextcodec.h"
50 #include "qapplication.h"
51 #include "qpoint.h"
52 #include "qwidget.h"
53 #include "qbuffer.h"
54 #include "qimage.h"
55 #include "qregexp.h"
56 #include "qdir.h"
57 #include "qdnd_p.h"
58 #include "qimagereader.h"
59 #include "qimagewriter.h"
60 #include "qdebug.h"
61 #include <ctype.h>
62 
63 #include <private/qapplication_p.h>
64 
65 #ifndef QT_NO_DRAGANDDROP
66 
68 
69 #ifndef QT_NO_DRAGANDDROP
70 
71 //#define QDND_DEBUG
72 
73 #ifdef QDND_DEBUG
74 QString dragActionsToString(Qt::DropActions actions)
75 {
76  QString str;
77  if (actions == Qt::IgnoreAction) {
78  if (!str.isEmpty())
79  str += " | ";
80  str += "IgnoreAction";
81  }
82  if (actions & Qt::LinkAction) {
83  if (!str.isEmpty())
84  str += " | ";
85  str += "LinkAction";
86  }
87  if (actions & Qt::CopyAction) {
88  if (!str.isEmpty())
89  str += " | ";
90  str += "CopyAction";
91  }
92  if (actions & Qt::MoveAction) {
93  if (!str.isEmpty())
94  str += " | ";
95  str += "MoveAction";
96  }
97  if ((actions & Qt::TargetMoveAction) == Qt::TargetMoveAction ) {
98  if (!str.isEmpty())
99  str += " | ";
100  str += "TargetMoveAction";
101  }
102  return str;
103 }
104 
105 QString KeyboardModifiersToString(Qt::KeyboardModifiers moderfies)
106 {
107  QString str;
108  if (moderfies & Qt::ControlModifier) {
109  if (!str.isEmpty())
110  str += " | ";
111  str += Qt::ControlModifier;
112  }
113  if (moderfies & Qt::AltModifier) {
114  if (!str.isEmpty())
115  str += " | ";
116  str += Qt::AltModifier;
117  }
118  if (moderfies & Qt::ShiftModifier) {
119  if (!str.isEmpty())
120  str += " | ";
121  str += Qt::ShiftModifier;
122  }
123  return str;
124 }
125 #endif
126 
127 
128 // the universe's only drag manager
130 
131 
133  : QObject(qApp)
134 {
135  Q_ASSERT(!instance);
136 
137 #ifdef Q_WS_QWS
139 #endif
140  object = 0;
141  beingCancelled = false;
142  restoreCursor = false;
143  willDrop = false;
144  eventLoop = 0;
145  dropData = new QDropData();
146  currentDropTarget = 0;
147 #ifdef Q_WS_X11
149 #endif
150 }
151 
152 
154 {
155 #ifndef QT_NO_CURSOR
156  if (restoreCursor)
158 #endif
159  instance = 0;
160  delete dropData;
161 }
162 
164 {
166  instance = new QDragManager;
167  return instance;
168 }
169 
171 {
172  QDragPrivate * d = dragPrivate();
173  if (d && d->customCursors.contains(action))
174  return d->customCursors[action];
175  else if (action == Qt::MoveAction)
177  else if (action == Qt::CopyAction)
179  else if (action == Qt::LinkAction)
181 #ifdef Q_WS_WIN
182  else if (action == Qt::IgnoreAction)
184 #endif
185  return QPixmap();
186 }
187 
189 {
190  QDragPrivate * d = dragPrivate();
191  return d && !d->customCursors.isEmpty();
192 }
193 
194 Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions,
195  Qt::KeyboardModifiers modifiers) const
196 {
197 #ifdef QDND_DEBUG
198  qDebug("QDragManager::defaultAction(Qt::DropActions possibleActions)");
199  qDebug("keyboard modifiers : %s", KeyboardModifiersToString(modifiers).latin1());
200 #endif
201 
204 
205  if (defaultAction == Qt::IgnoreAction) {
206  //This means that the drag was initiated by QDrag::start and we need to
207  //preserve the old behavior
208 #ifdef Q_WS_MAC
209  defaultAction = Qt::MoveAction;
210 #else
211  defaultAction = Qt::CopyAction;
212 #endif
213  }
214 
215 #ifdef Q_WS_MAC
216  if (modifiers & Qt::ControlModifier && modifiers & Qt::AltModifier)
217  defaultAction = Qt::LinkAction;
218  else if (modifiers & Qt::AltModifier)
219  defaultAction = Qt::CopyAction;
220  else if (modifiers & Qt::ControlModifier)
221  defaultAction = Qt::MoveAction;
222 #else
223  if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier)
224  defaultAction = Qt::LinkAction;
225  else if (modifiers & Qt::ControlModifier)
226  defaultAction = Qt::CopyAction;
227  else if (modifiers & Qt::ShiftModifier)
228  defaultAction = Qt::MoveAction;
229  else if (modifiers & Qt::AltModifier)
230  defaultAction = Qt::LinkAction;
231 #endif
232 
233  // if the object is set take the list of possibles from it
234  if (object)
235  possibleActions = object->d_func()->possible_actions;
236 
237 #ifdef QDND_DEBUG
238  qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1());
239 #endif
240 
241  // Check if the action determined is allowed
242  if (!(possibleActions & defaultAction)) {
243  if (possibleActions & Qt::CopyAction)
244  defaultAction = Qt::CopyAction;
245  else if (possibleActions & Qt::MoveAction)
246  defaultAction = Qt::MoveAction;
247  else if (possibleActions & Qt::LinkAction)
248  defaultAction = Qt::LinkAction;
249  else
250  defaultAction = Qt::IgnoreAction;
251  }
252 
253 #ifdef QDND_DEBUG
254  qDebug("default action : %s", dragActionsToString(defaultAction).latin1());
255 #endif
256 
257  return defaultAction;
258 }
259 
260 void QDragManager::setCurrentTarget(QWidget *target, bool dropped)
261 {
262  if (currentDropTarget == target)
263  return;
264 
265  currentDropTarget = target;
266  if (!dropped && object) {
267  object->d_func()->target = target;
268  emit object->targetChanged(target);
269  }
270 
271 }
272 
274 {
275  return currentDropTarget;
276 }
277 
278 #endif
279 
282 {
283 }
284 
286 {
287 }
288 #endif // QT_NO_DRAGANDDROP
289 
290 #if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
291 
293 {
296  for (int i = 0; i < imageFormats.size(); ++i) {
297  QString format = QLatin1String("image/");
298  format += QString::fromLatin1(imageFormats.at(i).toLower());
299  formats.append(format);
300  }
301 
302  //put png at the front because it is best
303  int pngIndex = formats.indexOf(QLatin1String("image/png"));
304  if (pngIndex != -1 && pngIndex != 0)
305  formats.move(pngIndex, 0);
306 
307  return formats;
308 }
309 
310 
312 {
315  for (int i = 0; i < imageFormats.size(); ++i) {
316  QString format = QLatin1String("image/");
317  format += QString::fromLatin1(imageFormats.at(i).toLower());
318  formats.append(format);
319  }
320 
321  //put png at the front because it is best
322  int pngIndex = formats.indexOf(QLatin1String("image/png"));
323  if (pngIndex != -1 && pngIndex != 0)
324  formats.move(pngIndex, 0);
325 
326  return formats;
327 }
328 
330  : QMimeData()
331 {
332 }
333 
335 {
336 }
337 
338 bool QInternalMimeData::hasFormat(const QString &mimeType) const
339 {
340  bool foundFormat = hasFormat_sys(mimeType);
341  if (!foundFormat && mimeType == QLatin1String("application/x-qt-image")) {
342  QStringList imageFormats = imageReadMimeFormats();
343  for (int i = 0; i < imageFormats.size(); ++i) {
344  if ((foundFormat = hasFormat_sys(imageFormats.at(i))))
345  break;
346  }
347  }
348  return foundFormat;
349 }
350 
352 {
353  QStringList realFormats = formats_sys();
354  if (!realFormats.contains(QLatin1String("application/x-qt-image"))) {
355  QStringList imageFormats = imageReadMimeFormats();
356  for (int i = 0; i < imageFormats.size(); ++i) {
357  if (realFormats.contains(imageFormats.at(i))) {
358  realFormats += QLatin1String("application/x-qt-image");
359  break;
360  }
361  }
362  }
363  return realFormats;
364 }
365 
367 {
368  QVariant data = retrieveData_sys(mimeType, type);
369  if (mimeType == QLatin1String("application/x-qt-image")) {
370  if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) {
371  // try to find an image
372  QStringList imageFormats = imageReadMimeFormats();
373  for (int i = 0; i < imageFormats.size(); ++i) {
374  data = retrieveData_sys(imageFormats.at(i), type);
375  if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty()))
376  continue;
377  break;
378  }
379  }
380  // we wanted some image type, but all we got was a byte array. Convert it to an image.
381  if (data.type() == QVariant::ByteArray
382  && (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap))
383  data = QImage::fromData(data.toByteArray());
384 
385  } else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) {
386  QColor c;
387  QByteArray ba = data.toByteArray();
388  if (ba.size() == 8) {
389  ushort * colBuf = (ushort *)ba.data();
390  c.setRgbF(qreal(colBuf[0]) / qreal(0xFFFF),
391  qreal(colBuf[1]) / qreal(0xFFFF),
392  qreal(colBuf[2]) / qreal(0xFFFF),
393  qreal(colBuf[3]) / qreal(0xFFFF));
394  data = c;
395  } else {
396  qWarning("Qt: Invalid color format");
397  }
398  } else if (data.type() != type && data.type() == QVariant::ByteArray) {
399  // try to use mime data's internal conversion stuf.
400  QInternalMimeData *that = const_cast<QInternalMimeData *>(this);
401  that->setData(mimeType, data.toByteArray());
402  data = QMimeData::retrieveData(mimeType, type);
403  that->clear();
404  }
405  return data;
406 }
407 
409 {
410  return imageReadMimeFormats().contains(mimeType);
411 }
412 
413 // helper functions for rendering mimedata to the system, this is needed because QMimeData is in core.
415 {
416  QStringList realFormats = data->formats();
417  if (realFormats.contains(QLatin1String("application/x-qt-image"))) {
418  // add all supported image formats
419  QStringList imageFormats = imageWriteMimeFormats();
420  for (int i = 0; i < imageFormats.size(); ++i) {
421  if (!realFormats.contains(imageFormats.at(i)))
422  realFormats.append(imageFormats.at(i));
423  }
424  }
425  return realFormats;
426 }
427 
429 {
430 
431  bool foundFormat = data->hasFormat(mimeType);
432  if (!foundFormat) {
433  if (mimeType == QLatin1String("application/x-qt-image")) {
434  // check all supported image formats
435  QStringList imageFormats = imageWriteMimeFormats();
436  for (int i = 0; i < imageFormats.size(); ++i) {
437  if ((foundFormat = data->hasFormat(imageFormats.at(i))))
438  break;
439  }
440  } else if (mimeType.startsWith(QLatin1String("image/"))) {
441  return data->hasImage() && imageWriteMimeFormats().contains(mimeType);
442  }
443  }
444  return foundFormat;
445 }
446 
448 {
449  QByteArray ba;
450  if (mimeType == QLatin1String("application/x-color")) {
451  /* QMimeData can only provide colors as QColor or the name
452  of a color as a QByteArray or a QString. So we need to do
453  the conversion to application/x-color here.
454  The application/x-color format is :
455  type: application/x-color
456  format: 16
457  data[0]: red
458  data[1]: green
459  data[2]: blue
460  data[3]: opacity
461  */
462  ba.resize(8);
463  ushort * colBuf = (ushort *)ba.data();
464  QColor c = qvariant_cast<QColor>(data->colorData());
465  colBuf[0] = ushort(c.redF() * 0xFFFF);
466  colBuf[1] = ushort(c.greenF() * 0xFFFF);
467  colBuf[2] = ushort(c.blueF() * 0xFFFF);
468  colBuf[3] = ushort(c.alphaF() * 0xFFFF);
469  } else {
470  ba = data->data(mimeType);
471  if (ba.isEmpty()) {
472  if (mimeType == QLatin1String("application/x-qt-image") && data->hasImage()) {
473  QImage image = qvariant_cast<QImage>(data->imageData());
474  QBuffer buf(&ba);
475  buf.open(QBuffer::WriteOnly);
476  // would there not be PNG ??
477  image.save(&buf, "PNG");
478  } else if (mimeType.startsWith(QLatin1String("image/")) && data->hasImage()) {
479  QImage image = qvariant_cast<QImage>(data->imageData());
480  QBuffer buf(&ba);
481  buf.open(QBuffer::WriteOnly);
482  image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper());
483  }
484  }
485  }
486  return ba;
487 }
488 
489 #endif // QT_NO_DRAGANDDROP && QT_NO_CLIPBOARD
490 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
~QDragManager()
Definition: qdnd.cpp:153
void setData(const QString &mimetype, const QByteArray &data)
Sets the data associated with the MIME type given by mimeType to the specified data.
Definition: qmimedata.cpp:547
int type
Definition: qmetatype.cpp:239
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageReader.
void clear()
Removes all the MIME type and data entries in the object.
Definition: qmimedata.cpp:613
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
virtual QStringList formats() const
Returns a list of formats supported by the object.
Definition: qmimedata.cpp:579
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
static QStringList imageWriteMimeFormats()
Definition: qdnd.cpp:311
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
Definition: qvariant.cpp:3102
bool restoreCursor
Definition: qdnd_p.h:243
QVariant colorData() const
Returns a color if the data stored in the object represents a color (MIME type application/x-color); ...
Definition: qmimedata.cpp:489
Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const
Definition: qdnd.cpp:194
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static QStringList formatsHelper(const QMimeData *data)
Definition: qdnd.cpp:414
void setRgbF(qreal r, qreal g, qreal b, qreal a=1.0)
Sets the color channels of this color to r (red), g (green), b (blue) and a (alpha, transparency).
Definition: qcolor.cpp:954
QString toUpper() const Q_REQUIRED_RESULT
Returns an uppercase copy of the string.
Definition: qstring.cpp:5483
Qt::DropAction currentActionForOverrideCursor
Definition: qdnd_p.h:265
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool save(const QString &fileName, const char *format=0, int quality=-1) const
Saves the image to the file with the given fileName, using the given image file format and quality fa...
Definition: qimage.cpp:5346
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
QMap< Qt::DropAction, QPixmap > customCursors
Definition: qdnd_p.h:184
QByteArray toLower() const
Returns a lowercase copy of the byte array.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QApplicationPrivate * instance()
QEventLoop * eventLoop
Definition: qdnd_p.h:245
QByteArray data(const QString &mimetype) const
Returns the data stored in the object in the format described by the MIME type specified by mimeType...
Definition: qmimedata.cpp:524
The QBuffer class provides a QIODevice interface for a QByteArray.
Definition: qbuffer.h:57
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
Definition: qvariant.cpp:2383
bool hasFormat(const QString &mimeType) const
Returns true if the object can return data for the MIME type specified by mimeType; otherwise returns...
Definition: qdnd.cpp:338
void move(int from, int to)
Moves the item at index position from to index position to.
Definition: qlist.h:628
Q_CORE_EXPORT void qDebug(const char *,...)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
int indexOf(const QRegExp &rx, int from=0) const
Returns the index position of the first exact match of rx in the list, searching forward from index p...
Definition: qstringlist.h:195
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QStringList formats() const
Returns a list of formats supported by the object.
Definition: qdnd.cpp:351
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static bool hasFormatHelper(const QString &mimeType, const QMimeData *data)
Definition: qdnd.cpp:428
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
virtual QStringList formats_sys() const =0
Type
This enum type defines the types of variable that a QVariant can contain.
Definition: qvariant.h:95
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
DropAction
Definition: qnamespace.h:1597
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data)
Definition: qdnd.cpp:447
static bool canReadData(const QString &mimeType)
Definition: qdnd.cpp:408
bool willDrop
Definition: qdnd_p.h:244
static QDragManager * self()
Definition: qdnd.cpp:163
QVariant imageData() const
Returns a QVariant storing a QImage if the object can return an image; otherwise returns a null varia...
Definition: qmimedata.cpp:442
bool hasImage() const
Returns true if the object can return an image; otherwise returns false.
Definition: qmimedata.cpp:471
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
virtual bool hasFormat(const QString &mimetype) const
Returns true if the object can return data for the MIME type specified by mimeType; otherwise returns...
Definition: qmimedata.cpp:563
QVariant retrieveData(const QString &mimeType, QVariant::Type type) const
Returns a variant with the given type containing data for the MIME type specified by mimeType...
Definition: qdnd.cpp:366
void setCurrentTarget(QWidget *target, bool dropped=false)
Definition: qdnd.cpp:260
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
QPixmap getPixmapCursor(Qt::CursorShape cshape)
unsigned short ushort
Definition: qglobal.h:995
QWidget * currentTarget()
Definition: qdnd.cpp:273
virtual QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const
Returns a variant with the given type containing data for the MIME type specified by mimeType...
Definition: qmimedata.cpp:603
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
Type type() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1901
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
QDropData * dropData
Definition: qdnd_p.h:251
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.
Definition: qlist.h:137
bool isEmpty() const
Returns true if the map contains no items; otherwise returns false.
Definition: qmap.h:203
if(void) toggleToolbarShown
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269
bool contains(const Key &key) const
Returns true if the map contains an item with key key; otherwise returns false.
Definition: qmap.h:553
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
~QDropData()
Definition: qdnd.cpp:285
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QWidget * currentDropTarget
Definition: qdnd_p.h:272
QDropData()
Definition: qdnd.cpp:280
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
bool beingCancelled
Definition: qdnd_p.h:242
QPixmap dragCursor(Qt::DropAction action) const
Definition: qdnd.cpp:170
static QStringList imageReadMimeFormats()
Definition: qdnd.cpp:292
QDragManager()
Definition: qdnd.cpp:132
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageWriter.
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
bool hasCustomDragCursors() const
Definition: qdnd.cpp:188
virtual QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const =0
virtual bool hasFormat_sys(const QString &mimeType) const =0
QDragPrivate * dragPrivate() const
Definition: qdnd_p.h:231
static QImage fromData(const uchar *data, int size, const char *format=0)
Constructs a QImage from the first size bytes of the given binary data.
Definition: qimage.cpp:5313
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
int xdndMimeTransferedPixmapIndex
Definition: qdnd_p.h:260
static QDragManager * instance
Definition: qdnd_p.h:274
Qt::DropAction defaultDropAction
Definition: qdnd_p.h:185