Qt 4.8
qdnd_win.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 "qapplication.h"
43 
44 #include "qapplication_p.h"
45 #include "qevent.h"
46 #include "qpainter.h"
47 #include "qwidget.h"
48 #include "qbuffer.h"
49 #include "qdatastream.h"
50 #include "qcursor.h"
51 #include "qt_windows.h"
52 #include <shlobj.h>
53 #ifndef QT_NO_ACCESSIBILITY
54 #include "qaccessible.h"
55 #endif
56 #include "qdnd_p.h"
57 #include "qdebug.h"
58 
59 #if defined(Q_OS_WINCE)
60 #include "qguifunctions_wince.h"
61 #endif
62 
63 // support for xbuttons
64 #ifndef MK_XBUTTON1
65 #define MK_XBUTTON1 0x0020
66 #define MK_XBUTTON2 0x0040
67 #endif
68 
70 
71 #if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
72 
73 //---------------------------------------------------------------------
74 // QOleDataObject Constructor
75 //---------------------------------------------------------------------
76 
78 {
79  m_refs = 1;
80  data = mimeData;
81  CF_PERFORMEDDROPEFFECT = RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT);
82  performedEffect = DROPEFFECT_NONE;
83 }
84 
86 {
87 }
88 
90 {
91  data = 0;
92 }
93 
95 {
96  return data;
97 }
98 
100 {
101  return performedEffect;
102 }
103 
104 //---------------------------------------------------------------------
105 // IUnknown Methods
106 //---------------------------------------------------------------------
107 
108 STDMETHODIMP
109 QOleDataObject::QueryInterface(REFIID iid, void FAR* FAR* ppv)
110 {
111  if (iid == IID_IUnknown || iid == IID_IDataObject) {
112  *ppv = this;
113  AddRef();
114  return NOERROR;
115  }
116  *ppv = NULL;
117  return ResultFromScode(E_NOINTERFACE);
118 }
119 
120 STDMETHODIMP_(ULONG)
121 QOleDataObject::AddRef(void)
122 {
123  return ++m_refs;
124 }
125 
126 STDMETHODIMP_(ULONG)
128 {
129  if (--m_refs == 0) {
130  releaseQt();
131  delete this;
132  return 0;
133  }
134  return m_refs;
135 }
136 
137 //---------------------------------------------------------------------
138 // IDataObject Methods
139 //
140 // The following methods are NOT supported for data transfer using the
141 // clipboard or drag-drop:
142 //
143 // IDataObject::SetData -- return E_NOTIMPL
144 // IDataObject::DAdvise -- return OLE_E_ADVISENOTSUPPORTED
145 // ::DUnadvise
146 // ::EnumDAdvise
147 // IDataObject::GetCanonicalFormatEtc -- return E_NOTIMPL
148 // (NOTE: must set pformatetcOut->ptd = NULL)
149 //---------------------------------------------------------------------
150 
151 STDMETHODIMP
152 QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
153 {
154 #ifdef QDND_DEBUG
155  qDebug("QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)");
156 #ifndef Q_OS_WINCE
157  wchar_t buf[256] = {0};
158  GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
159  qDebug("CF = %d : %s", pformatetc->cfFormat, QString::fromWCharArray(buf));
160 #endif
161 #endif
162 
163  if (!data)
164  return ResultFromScode(DATA_E_FORMATETC);
165 
166  QWindowsMime *converter = QWindowsMime::converterFromMime(*pformatetc, data);
167 
168  if (converter && converter->convertFromMime(*pformatetc, data, pmedium))
169  return ResultFromScode(S_OK);
170  else
171  return ResultFromScode(DATA_E_FORMATETC);
172 }
173 
174 STDMETHODIMP
175 QOleDataObject::GetDataHere(LPFORMATETC, LPSTGMEDIUM)
176 {
177  return ResultFromScode(DATA_E_FORMATETC);
178 }
179 
180 STDMETHODIMP
181 QOleDataObject::QueryGetData(LPFORMATETC pformatetc)
182 {
183 #ifdef QDND_DEBUG
184  qDebug("QOleDataObject::QueryGetData(LPFORMATETC pformatetc)");
185 #endif
186 
187  if (!data)
188  return ResultFromScode(DATA_E_FORMATETC);
189 
190  if (QWindowsMime::converterFromMime(*pformatetc, data))
191  return ResultFromScode(S_OK);
192  return ResultFromScode(S_FALSE);
193 }
194 
195 STDMETHODIMP
196 QOleDataObject::GetCanonicalFormatEtc(LPFORMATETC, LPFORMATETC pformatetcOut)
197 {
198  pformatetcOut->ptd = NULL;
199  return ResultFromScode(E_NOTIMPL);
200 }
201 
202 STDMETHODIMP
203 QOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL fRelease)
204 {
205  if (pFormatetc->cfFormat == CF_PERFORMEDDROPEFFECT && pMedium->tymed == TYMED_HGLOBAL) {
206  DWORD * val = (DWORD*)GlobalLock(pMedium->hGlobal);
207  performedEffect = *val;
208  GlobalUnlock(pMedium->hGlobal);
209  if (fRelease)
210  ReleaseStgMedium(pMedium);
211  return ResultFromScode(S_OK);
212  }
213  return ResultFromScode(E_NOTIMPL);
214 }
215 
216 
217 STDMETHODIMP
218 QOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc)
219 {
220 #ifdef QDND_DEBUG
221  qDebug("QOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc)");
222 #endif
223 
224  if (!data)
225  return ResultFromScode(DATA_E_FORMATETC);
226 
227  SCODE sc = S_OK;
228 
229  QVector<FORMATETC> fmtetcs;
230  if (dwDirection == DATADIR_GET) {
232  } else {
233  FORMATETC formatetc;
234  formatetc.cfFormat = CF_PERFORMEDDROPEFFECT;
235  formatetc.dwAspect = DVASPECT_CONTENT;
236  formatetc.lindex = -1;
237  formatetc.ptd = NULL;
238  formatetc.tymed = TYMED_HGLOBAL;
239  fmtetcs.append(formatetc);
240  }
241 
242  QOleEnumFmtEtc *enumFmtEtc = new QOleEnumFmtEtc(fmtetcs);
243  *ppenumFormatEtc = enumFmtEtc;
244  if (enumFmtEtc->isNull()) {
245  delete enumFmtEtc;
246  *ppenumFormatEtc = NULL;
247  sc = E_OUTOFMEMORY;
248  }
249 
250  return ResultFromScode(sc);
251 }
252 
253 STDMETHODIMP
255  LPADVISESINK, DWORD FAR*)
256 {
257  return ResultFromScode(OLE_E_ADVISENOTSUPPORTED);
258 }
259 
260 
261 STDMETHODIMP
263 {
264  return ResultFromScode(OLE_E_ADVISENOTSUPPORTED);
265 }
266 
267 STDMETHODIMP
268 QOleDataObject::EnumDAdvise(LPENUMSTATDATA FAR*)
269 {
270  return ResultFromScode(OLE_E_ADVISENOTSUPPORTED);
271 }
272 
273 #endif // QT_NO_DRAGANDDROP && QT_NO_CLIPBOARD
274 
275 #ifndef QT_NO_DRAGANDDROP
276 
277 //#define QDND_DEBUG
278 
279 #ifdef QDND_DEBUG
280 extern QString dragActionsToString(Qt::DropActions actions);
281 #endif
282 
283 Qt::DropActions translateToQDragDropActions(DWORD pdwEffects)
284 {
285  Qt::DropActions actions = Qt::IgnoreAction;
286  if (pdwEffects & DROPEFFECT_LINK)
287  actions |= Qt::LinkAction;
288  if (pdwEffects & DROPEFFECT_COPY)
289  actions |= Qt::CopyAction;
290  if (pdwEffects & DROPEFFECT_MOVE)
291  actions |= Qt::MoveAction;
292  return actions;
293 }
294 
296 {
297  if (pdwEffect & DROPEFFECT_LINK)
298  return Qt::LinkAction;
299  if (pdwEffect & DROPEFFECT_COPY)
300  return Qt::CopyAction;
301  if (pdwEffect & DROPEFFECT_MOVE)
302  return Qt::MoveAction;
303  return Qt::IgnoreAction;
304 }
305 
306 DWORD translateToWinDragEffects(Qt::DropActions action)
307 {
308  DWORD effect = DROPEFFECT_NONE;
309  if (action & Qt::LinkAction)
310  effect |= DROPEFFECT_LINK;
311  if (action & Qt::CopyAction)
312  effect |= DROPEFFECT_COPY;
313  if (action & Qt::MoveAction)
314  effect |= DROPEFFECT_MOVE;
315  return effect;
316 }
317 
318 Qt::KeyboardModifiers toQtKeyboardModifiers(DWORD keyState)
319 {
320  Qt::KeyboardModifiers modifiers = Qt::NoModifier;
321 
322  if (keyState & MK_SHIFT)
323  modifiers |= Qt::ShiftModifier;
324  if (keyState & MK_CONTROL)
325  modifiers |= Qt::ControlModifier;
326  if (keyState & MK_ALT)
327  modifiers |= Qt::AltModifier;
328 
329  return modifiers;
330 }
331 
332 Qt::MouseButtons toQtMouseButtons(DWORD keyState)
333 {
334  Qt::MouseButtons buttons = Qt::NoButton;
335 
336  if (keyState & MK_LBUTTON)
337  buttons |= Qt::LeftButton;
338  if (keyState & MK_RBUTTON)
339  buttons |= Qt::RightButton;
340  if (keyState & MK_MBUTTON)
341  buttons |= Qt::MidButton;
342 
343  return buttons;
344 }
345 
346 class QOleDropSource : public IDropSource
347 {
348 public:
349  QOleDropSource();
350  virtual ~QOleDropSource();
351 
352  void createCursors();
353 
354  // IUnknown methods
355  STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObj);
356  STDMETHOD_(ULONG,AddRef)(void);
357  STDMETHOD_(ULONG,Release)(void);
358 
359  // IDropSource methods
360  STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState);
361  STDMETHOD(GiveFeedback)(DWORD dwEffect);
362 
363 private:
364  Qt::MouseButtons currentButtons;
367 
368  ULONG m_refs;
369 };
370 
371 
373 {
374  currentButtons = Qt::NoButton;
375  m_refs = 1;
376  currentAction = Qt::IgnoreAction;
377 }
378 
380 {
381 }
382 
384 {
385  QDragManager *manager = QDragManager::self();
386  if (manager && manager->object
387  && (!manager->object->pixmap().isNull()
388  || manager->hasCustomDragCursors())) {
389  QPixmap pm = manager->object->pixmap();
390  QList<Qt::DropAction> actions;
392  if (!manager->object->pixmap().isNull())
393  actions << Qt::IgnoreAction;
394  QPoint hotSpot = manager->object->hotSpot();
395  for (int cnum = 0; cnum < actions.size(); ++cnum) {
396  QPixmap cpm = manager->dragCursor(actions.at(cnum));
397  int w = cpm.width();
398  int h = cpm.height();
399 
400  if (!pm.isNull()) {
401  int x1 = qMin(-hotSpot.x(), 0);
402  int x2 = qMax(pm.width() - hotSpot.x(), cpm.width());
403  int y1 = qMin(-hotSpot.y(), 0);
404  int y2 = qMax(pm.height() - hotSpot.y(), cpm.height());
405 
406  w = x2 - x1 + 1;
407  h = y2 - y1 + 1;
408  }
409 
410  QRect srcRect = pm.rect();
411  QPoint pmDest = QPoint(qMax(0, -hotSpot.x()), qMax(0, -hotSpot.y()));
412  QPoint newHotSpot = hotSpot;
413 
414 #if defined(Q_OS_WINCE)
415  // Limited cursor size
416  int reqw = GetSystemMetrics(SM_CXCURSOR);
417  int reqh = GetSystemMetrics(SM_CYCURSOR);
418 
419  QPoint hotspotInPM = newHotSpot - pmDest;
420  if (reqw < w) {
421  // Not wide enough - move objectpm right
422  qreal r = qreal(newHotSpot.x()) / w;
423  newHotSpot = QPoint(int(r * reqw), newHotSpot.y());
424  if (newHotSpot.x() + cpm.width() > reqw)
425  newHotSpot.setX(reqw - cpm.width());
426 
427  srcRect = QRect(QPoint(hotspotInPM.x() - newHotSpot.x(), srcRect.top()), QSize(reqw, srcRect.height()));
428  }
429  if (reqh < h) {
430  qreal r = qreal(newHotSpot.y()) / h;
431  newHotSpot = QPoint(newHotSpot.x(), int(r * reqh));
432  if (newHotSpot.y() + cpm.height() > reqh)
433  newHotSpot.setY(reqh - cpm.height());
434 
435  srcRect = QRect(QPoint(srcRect.left(), hotspotInPM.y() - newHotSpot.y()), QSize(srcRect.width(), reqh));
436  }
437  // Always use system cursor size
438  w = reqw;
439  h = reqh;
440 #endif
441 
442  QPixmap newCursor(w, h);
443  if (!pm.isNull()) {
444  newCursor.fill(QColor(0, 0, 0, 0));
445  QPainter p(&newCursor);
446  p.drawPixmap(pmDest, pm, srcRect);
447  p.drawPixmap(qMax(0,newHotSpot.x()),qMax(0,newHotSpot.y()),cpm);
448  } else {
449  newCursor = cpm;
450  }
451 
452 #ifndef QT_NO_CURSOR
453  cursors[actions.at(cnum)] = QCursor(newCursor, pm.isNull() ? 0 : qMax(0,newHotSpot.x()),
454  pm.isNull() ? 0 : qMax(0,newHotSpot.y()));
455 #endif
456  }
457  }
458 }
459 
460 
461 
462 //---------------------------------------------------------------------
463 // IUnknown Methods
464 //---------------------------------------------------------------------
465 
466 
467 STDMETHODIMP
468 QOleDropSource::QueryInterface(REFIID iid, void FAR* FAR* ppv)
469 {
470  if(iid == IID_IUnknown || iid == IID_IDropSource)
471  {
472  *ppv = this;
473  ++m_refs;
474  return NOERROR;
475  }
476  *ppv = NULL;
477  return ResultFromScode(E_NOINTERFACE);
478 }
479 
480 
481 STDMETHODIMP_(ULONG)
482 QOleDropSource::AddRef(void)
483 {
484  return ++m_refs;
485 }
486 
487 
488 STDMETHODIMP_(ULONG)
490 {
491  if(--m_refs == 0)
492  {
493  delete this;
494  return 0;
495  }
496  return m_refs;
497 }
498 
499 static inline Qt::MouseButtons keystate_to_mousebutton(DWORD grfKeyState)
500 {
501  Qt::MouseButtons result;
502  if (grfKeyState & MK_LBUTTON)
503  result |= Qt::LeftButton;
504  if (grfKeyState & MK_MBUTTON)
505  result |= Qt::MidButton;
506  if (grfKeyState & MK_RBUTTON)
507  result |= Qt::RightButton;
508  if (grfKeyState & MK_XBUTTON1)
509  result |= Qt::XButton1;
510  if (grfKeyState & MK_XBUTTON2)
511  result |= Qt::XButton2;
512  return result;
513 }
514 
515 //---------------------------------------------------------------------
516 // IDropSource Methods
517 //---------------------------------------------------------------------
519 QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
520 {
521 #ifdef QDND_DEBUG
522  qDebug("QOleDropSource::QueryContinueDrag(fEscapePressed %d, grfKeyState %d)", fEscapePressed, grfKeyState);
523 #endif
524 
525  if (fEscapePressed) {
526  return ResultFromScode(DRAGDROP_S_CANCEL);
527  } else if ((GetAsyncKeyState(VK_LBUTTON) == 0)
528  && (GetAsyncKeyState(VK_MBUTTON) == 0)
529  && (GetAsyncKeyState(VK_RBUTTON) == 0)) {
530  // grfKeyState is broken on CE & some Windows XP versions,
531  // therefore we need to check the state manually
532  return ResultFromScode(DRAGDROP_S_DROP);
533  } else {
534 #if !defined(Q_OS_WINCE)
535  if (currentButtons == Qt::NoButton) {
536  currentButtons = keystate_to_mousebutton(grfKeyState);
537  } else {
538  Qt::MouseButtons buttons = keystate_to_mousebutton(grfKeyState);
539  if (!(currentButtons & buttons))
540  return ResultFromScode(DRAGDROP_S_DROP);
541  }
542 #else
543  Q_UNUSED(grfKeyState);
544 #endif
546  return NOERROR;
547  }
548 }
549 
552 {
553  Qt::DropAction action = translateToQDragDropAction(dwEffect);
554 
555 #ifdef QDND_DEBUG
556  qDebug("QOleDropSource::GiveFeedback(DWORD dwEffect)");
557  qDebug("dwEffect = %s", dragActionsToString(action).toLatin1().data());
558 #endif
559 
560  if (currentAction != action) {
561  currentAction = action;
562  QDragManager::self()->emitActionChanged(currentAction);
563  }
564 
565  if (cursors.contains(currentAction)) {
566 #ifndef QT_NO_CURSOR
567  SetCursor(cursors[currentAction].handle());
568 #endif
569  return ResultFromScode(S_OK);
570  }
571 
572  return ResultFromScode(DRAGDROP_S_USEDEFAULTCURSORS);
573 }
574 
575 //---------------------------------------------------------------------
576 // QOleDropTarget
577 //---------------------------------------------------------------------
578 
580 : widget(w)
581 {
582  m_refs = 1;
583 }
584 
586 {
587  widget = 0;
588 }
589 
590 //---------------------------------------------------------------------
591 // IUnknown Methods
592 //---------------------------------------------------------------------
593 
594 
595 STDMETHODIMP
596 QOleDropTarget::QueryInterface(REFIID iid, void FAR* FAR* ppv)
597 {
598  if(iid == IID_IUnknown || iid == IID_IDropTarget)
599  {
600  *ppv = this;
601  AddRef();
602  return NOERROR;
603  }
604  *ppv = NULL;
605  return ResultFromScode(E_NOINTERFACE);
606 }
607 
608 
609 STDMETHODIMP_(ULONG)
610 QOleDropTarget::AddRef(void)
611 {
612  return ++m_refs;
613 }
614 
615 
616 STDMETHODIMP_(ULONG)
618 {
619  if(--m_refs == 0)
620  {
621  delete this;
622  return 0;
623  }
624  return m_refs;
625 }
626 
627 //---------------------------------------------------------------------
628 // IDropTarget Methods
629 //---------------------------------------------------------------------
630 
632 QOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
633 {
634 #ifdef QDND_DEBUG
635  qDebug("QOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)");
636 #endif
637 
639  *pdwEffect = DROPEFFECT_NONE;
640  return NOERROR;
641  }
642 
643  QDragManager *manager = QDragManager::self();
644  manager->dropData->currentDataObject = pDataObj;
645  manager->dropData->currentDataObject->AddRef();
646  sendDragEnterEvent(widget, grfKeyState, pt, pdwEffect);
647  *pdwEffect = chosenEffect;
648 
649  return NOERROR;
650 }
651 
652 void QOleDropTarget::sendDragEnterEvent(QWidget *dragEnterWidget, DWORD grfKeyState,
653  POINTL pt, LPDWORD pdwEffect)
654 {
655  Q_ASSERT(dragEnterWidget);
656  lastPoint = dragEnterWidget->mapFromGlobal(QPoint(pt.x,pt.y));
657  lastKeyState = grfKeyState;
658 
659  chosenEffect = DROPEFFECT_NONE;
660  currentWidget = dragEnterWidget;
661 
662  QDragManager *manager = QDragManager::self();
663  QMimeData * md = manager->source() ? manager->dragPrivate()->data : manager->dropData;
664  QDragEnterEvent enterEvent(lastPoint, translateToQDragDropActions(*pdwEffect), md,
665  toQtMouseButtons(grfKeyState), toQtKeyboardModifiers(grfKeyState));
666  QApplication::sendEvent(dragEnterWidget, &enterEvent);
667  answerRect = enterEvent.answerRect();
668 
669  if (enterEvent.isAccepted()) {
671  }
672 
673  // Documentation states that a drag move event is sendt immidiatly after
674  // a drag enter event. This will honor widgets overriding dragMoveEvent only:
675  if (enterEvent.isAccepted()) {
676  QDragMoveEvent moveEvent(lastPoint, translateToQDragDropActions(*pdwEffect), md,
677  toQtMouseButtons(grfKeyState), toQtKeyboardModifiers(grfKeyState));
678  answerRect = enterEvent.answerRect();
679  moveEvent.setDropAction(enterEvent.dropAction());
680  moveEvent.accept(); // accept by default, since enter event was accepted.
681 
682  QApplication::sendEvent(dragEnterWidget, &moveEvent);
683  if (moveEvent.isAccepted()) {
684  answerRect = moveEvent.answerRect();
686  } else {
687  chosenEffect = DROPEFFECT_NONE;
688  }
689  }
690 
691 }
692 
693 static inline bool acceptsDrop(const QWidget *w)
694 {
696 }
697 
699 QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
700 {
701 #ifdef QDND_DEBUG
702  qDebug("QOleDropTarget::DragOver(grfKeyState %d, pt (%d,%d), pdwEffect %d)", grfKeyState, pt.x, pt.y, pdwEffect);
703 #endif
704 
705  QWidget *dragOverWidget = widget->childAt(widget->mapFromGlobal(QPoint(pt.x, pt.y)));
706  if (!dragOverWidget)
707  dragOverWidget = widget;
708 
709 
710  if (!QApplicationPrivate::tryModalHelper(dragOverWidget)) {
711  *pdwEffect = DROPEFFECT_NONE;
712  return NOERROR;
713  }
714 
715  // Try to find a drop-enabled target in the hierarchy. Go beyond 'widget' in case
716  // it is a native child window which has its own drop site registered (QTBUG-27265).
717  while (dragOverWidget && !dragOverWidget->isWindow() && !acceptsDrop(dragOverWidget))
718  dragOverWidget = dragOverWidget->parentWidget();
719 
720  if (!dragOverWidget || !acceptsDrop(dragOverWidget)) {
721  *pdwEffect = DROPEFFECT_NONE;
722  return NOERROR;
723  }
724 
725  QPoint tmpPoint = dragOverWidget->mapFromGlobal(QPoint(pt.x, pt.y));
726  // see if we should compress this event
727  if ((tmpPoint == lastPoint || answerRect.contains(tmpPoint)) && lastKeyState == grfKeyState) {
728  *pdwEffect = chosenEffect;
729  return NOERROR;
730  }
731 
732  if (!dragOverWidget->internalWinId() && dragOverWidget != currentWidget) {
733  QPointer<QWidget> dragOverWidgetGuard(dragOverWidget);
734  // Send drag leave event to the previous drag widget.
735  QDragLeaveEvent dragLeave;
736  if (currentWidget)
738  if (!dragOverWidgetGuard) {
739  dragOverWidget = widget->childAt(widget->mapFromGlobal(QPoint(pt.x, pt.y)));
740  if (!dragOverWidget)
741  dragOverWidget = widget;
742  }
743  // Send drag enter event to the current drag widget.
744  sendDragEnterEvent(dragOverWidget, grfKeyState, pt, pdwEffect);
745  }
746 
747  QDragManager *manager = QDragManager::self();
748  QMimeData *md = manager->source() ? manager->dragPrivate()->data : manager->dropData;
749 
750  QDragMoveEvent oldEvent(lastPoint, translateToQDragDropActions(*pdwEffect), md,
752 
753 
754  lastPoint = tmpPoint;
755  lastKeyState = grfKeyState;
756 
758  toQtMouseButtons(grfKeyState), toQtKeyboardModifiers(grfKeyState));
759  if (chosenEffect != DROPEFFECT_NONE) {
760  if (oldEvent.dropAction() == e.dropAction() &&
761  oldEvent.keyboardModifiers() == e.keyboardModifiers())
763  e.accept();
764  }
765  QApplication::sendEvent(dragOverWidget, &e);
766 
767  answerRect = e.answerRect();
768  if (e.isAccepted())
770  else
771  chosenEffect = DROPEFFECT_NONE;
772  *pdwEffect = chosenEffect;
773 
774  return NOERROR;
775 }
776 
779 {
780 #ifdef QDND_DEBUG
781  qDebug("QOleDropTarget::DragLeave()");
782 #endif
783 
785  return NOERROR;
786  }
787 
788  currentWidget = 0;
789  QDragLeaveEvent e;
791 
792  QDragManager *manager = QDragManager::self();
793 
794  if (manager->dropData->currentDataObject) { // Sanity
795  manager->dropData->currentDataObject->Release();
796  manager->dropData->currentDataObject = 0;
797  }
798 
799  return NOERROR;
800 }
801 
802 #define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)
803 
805 QOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
806 {
807 #ifdef QDND_DEBUG
808  qDebug("QOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, grfKeyState %d, POINTL pt, LPDWORD pdwEffect)", grfKeyState);
809 #endif
810 
812  if (!dropWidget)
813  dropWidget = widget;
814 
815  if (!QApplicationPrivate::tryModalHelper(dropWidget)
816  || !dropWidget->testAttribute(Qt::WA_DropSiteRegistered)) {
817  *pdwEffect = DROPEFFECT_NONE;
818  return NOERROR;
819  }
820 
821  lastPoint = dropWidget->mapFromGlobal(QPoint(pt.x,pt.y));
822  // grfKeyState does not all ways contain button state in the drop so if
823  // it doesn't then use the last known button state;
824  if ((grfKeyState & KEY_STATE_BUTTON_MASK) == 0)
825  grfKeyState |= lastKeyState & KEY_STATE_BUTTON_MASK;
826  lastKeyState = grfKeyState;
827 
828  QDragManager *manager = QDragManager::self();
829  QMimeData *md = manager->source() ? manager->dragPrivate()->data : manager->dropData;
831  toQtMouseButtons(grfKeyState), toQtKeyboardModifiers(grfKeyState));
832  if (chosenEffect != DROPEFFECT_NONE) {
834  }
835  QApplication::sendEvent(dropWidget, &e);
836 
837  if (chosenEffect != DROPEFFECT_NONE) {
838  e.accept();
839  }
840 
841 
842  if (e.isAccepted()) {
844  if (e.dropAction() == Qt::MoveAction)
845  chosenEffect = DROPEFFECT_MOVE;
846  else
847  chosenEffect = DROPEFFECT_COPY;
848  HGLOBAL hData = GlobalAlloc(0, sizeof(DWORD));
849  if (hData) {
850  DWORD *moveEffect = (DWORD *)GlobalLock(hData);;
851  *moveEffect = DROPEFFECT_MOVE;
852  GlobalUnlock(hData);
853  STGMEDIUM medium;
854  memset(&medium, 0, sizeof(STGMEDIUM));
855  medium.tymed = TYMED_HGLOBAL;
856  medium.hGlobal = hData;
858  format.cfFormat = RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT);
859  format.tymed = TYMED_HGLOBAL;
860  format.ptd = 0;
861  format.dwAspect = 1;
862  format.lindex = -1;
863  manager->dropData->currentDataObject->SetData(&format, &medium, true);
864  }
865  } else {
867  }
868  } else {
869  chosenEffect = DROPEFFECT_NONE;
870  }
871  *pdwEffect = chosenEffect;
872 
873 
874  if (manager->dropData->currentDataObject) {
875  manager->dropData->currentDataObject->Release();
876  manager->dropData->currentDataObject = 0;
877  }
878 
879  return NOERROR;
880 
881  // We won't get any mouserelease-event, so manually adjust qApp state:
883 }
884 
885 //---------------------------------------------------------------------
886 // QDropData
887 //---------------------------------------------------------------------
888 
889 bool QDropData::hasFormat_sys(const QString &mimeType) const
890 {
891  if (!currentDataObject) // Sanity
892  return false;
893 
894  return QWindowsMime::converterToMime(mimeType, currentDataObject) != 0;
895 }
896 
898 {
899  QStringList fmts;
900  if (!currentDataObject) // Sanity
901  return fmts;
902 
903  fmts = QWindowsMime::allMimesForFormats(currentDataObject);
904 
905  return fmts;
906 }
907 
909 {
910  QVariant result;
911 
912  if (!currentDataObject) // Sanity
913  return result;
914 
915  QWindowsMime *converter = QWindowsMime::converterToMime(mimeType, currentDataObject);
916 
917  if (converter)
918  result = converter->convertToMime(mimeType, currentDataObject, type);
919 
920  return result;
921 }
922 
924 
925 {
926 #ifdef QDND_DEBUG
927  qDebug("QDragManager::drag(QDrag *drag)");
928 #endif
929 
930  if (object == o || !o || !o->d_func()->source)
931  return Qt::IgnoreAction;
932 
933  if (object) {
934  cancel();
935  qApp->removeEventFilter(this);
936  beingCancelled = false;
937  }
938 
939  object = o;
940 
941 #ifdef QDND_DEBUG
942  qDebug("actions = %s", dragActionsToString(dragPrivate()->possible_actions).toLatin1().data());
943 #endif
944 
945  dragPrivate()->target = 0;
946 
947 #ifndef QT_NO_ACCESSIBILITY
949 #endif
950 
951  DWORD resultEffect;
952  QOleDropSource *src = new QOleDropSource();
953  src->createCursors();
954  QOleDataObject *obj = new QOleDataObject(o->mimeData());
955  DWORD allowedEffects = translateToWinDragEffects(dragPrivate()->possible_actions);
956 
957 #if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS)
958  HRESULT r = DoDragDrop(obj, src, allowedEffects, &resultEffect);
959 #else
960  HRESULT r = DRAGDROP_S_CANCEL;
961  resultEffect = DROPEFFECT_MOVE;
962 #endif
963 
965  if (r == DRAGDROP_S_DROP) {
966  if (obj->reportedPerformedEffect() == DROPEFFECT_MOVE && resultEffect != DROPEFFECT_MOVE) {
967  ret = Qt::TargetMoveAction;
968  resultEffect = DROPEFFECT_MOVE;
969  } else {
970  ret = translateToQDragDropAction(resultEffect);
971  }
972  // Force it to be a copy if an unsupported operation occurred.
973  // This indicates a bug in the drop target.
974  if (resultEffect != DROPEFFECT_NONE && !(resultEffect & allowedEffects))
975  ret = Qt::CopyAction;
976  } else {
977  dragPrivate()->target = 0;
978  }
979 
980  // clean up
981  obj->releaseQt();
982  obj->Release(); // Will delete obj if refcount becomes 0
983  src->Release(); // Will delete src if refcount becomes 0
984  object = 0;
985  o->setMimeData(0);
986  o->deleteLater();
987 
988 #ifndef QT_NO_ACCESSIBILITY
990 #endif
991 
992  return ret;
993 }
994 
995 void QDragManager::cancel(bool /* deleteSource */)
996 {
997  if (object) {
998  beingCancelled = true;
999  object = 0;
1000  }
1001 
1002 #ifndef QT_NO_CURSOR
1003  // insert cancel code here ######## todo
1004 
1005  if (restoreCursor) {
1007  restoreCursor = false;
1008  }
1009 #endif
1010 #ifndef QT_NO_ACCESSIBILITY
1012 #endif
1013 }
1014 
1016 {
1017  // not used in windows implementation
1018 }
1019 
1021 {
1022  // not used in windows implementation
1023  return false;
1024 }
1025 
1027 {
1028  // not used in windows implementation
1029 }
1030 
1031 void QDragManager::move(const QPoint &)
1032 {
1033  // not used in windows implementation
1034 }
1035 
1036 void QDragManager::drop()
1037 {
1038  // not used in windows implementation
1039 }
1040 
1042 
1043 #endif // QT_NO_DRAGANDDROP
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
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...
Definition: qstring.cpp:1019
The QWindowsMime class maps open-standard MIME to Window Clipboard formats.
Definition: qmime.h:79
STDMETHOD() GetData(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium)
Definition: qdnd_win.cpp:152
ULONG m_refs
Definition: qdnd_p.h:301
void createCursors()
Definition: qdnd_win.cpp:383
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
QMap< Qt::DropAction, QCursor > cursors
Definition: qdnd_win.cpp:366
bool hasFormat_sys(const QString &mimeType) const
Definition: qdnd_mac.mm:214
QOleDropTarget(QWidget *w)
Definition: qdnd_win.cpp:579
int type
Definition: qmetatype.cpp:239
double qreal
Definition: qglobal.h:1193
STDMETHOD() Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
Definition: qdnd_win.cpp:805
QStringList formats_sys() const
Definition: qdnd_mac.mm:245
Qt::DropActions translateToQDragDropActions(DWORD pdwEffects)
Definition: qdnd_win.cpp:283
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QWidget * source() const
Returns the source of the drag object.
Definition: qdrag.cpp:209
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QPointer< QWidget > currentWidget
Definition: qdnd_p.h:303
The QDrag class provides support for MIME-based drag and drop data transfer.
Definition: qdrag.h:61
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
void setMimeData(QMimeData *data)
Sets the data to be sent to the given MIME data.
Definition: qdrag.cpp:142
QPointer< QWidget > widget
STDMETHOD() DragLeave()
Definition: qdnd_win.cpp:778
Qt::DropAction translateToQDragDropAction(DWORD pdwEffect)
Definition: qdnd_win.cpp:295
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
STDMETHOD() SetData(LPFORMATETC pformatetc, STGMEDIUM FAR *pmedium, BOOL fRelease)
Definition: qdnd_win.cpp:203
static QStringList allMimesForFormats(IDataObject *pDataObj)
Definition: qmime_win.cpp:392
void sendDragEnterEvent(QWidget *to, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
Definition: qdnd_win.cpp:652
QDrag * object
Definition: qdnd_p.h:238
DWORD reportedPerformedEffect() const
Definition: qdnd_win.cpp:99
bool isNull() const
Definition: qole_win.cpp:111
Qt::MouseButtons currentButtons
Definition: qdnd_win.cpp:364
static Qt::MouseButtons buttons
QPointer< QMimeData > data
Definition: qdnd_p.h:134
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void setDropAction(Qt::DropAction action)
Sets the action to be performed on the data by the target.
Definition: qevent.cpp:2746
STDMETHOD() GetDataHere(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
Definition: qdnd_win.cpp:175
Qt::DropAction dropAction() const
Returns the action to be performed on the data by the target.
Definition: qevent.h:494
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
void accept()
Calls QDropEvent::accept().
Definition: qevent.h:539
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QRect answerRect
Definition: qdnd_p.h:304
#define KEY_STATE_BUTTON_MASK
Definition: qdnd_win.cpp:802
DWORD performedEffect
Definition: qdnd_p.h:136
#define CFSTR_PERFORMEDDROPEFFECT
void cancel(bool deleteSource=true)
Definition: qdnd_mac.mm:272
struct tagFORMATETC FORMATETC
Definition: qmime.h:66
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QString class provides a Unicode character string.
Definition: qstring.h:83
STDMETHOD() DUnadvise(DWORD dwConnection)
Definition: qdnd_win.cpp:262
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
Definition: qevent.h:530
void emitActionChanged(Qt::DropAction newAction)
Definition: qdnd_p.h:253
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
Qt::KeyboardModifiers keyboardModifiers() const
Returns the modifier keys that are pressed.
Definition: qevent.h:488
static Qt::MouseButtons keystate_to_mousebutton(DWORD grfKeyState)
Definition: qdnd_win.cpp:499
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
DWORD translateToWinDragEffects(Qt::DropActions action)
Definition: qdnd_win.cpp:306
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Processes all pending events for the calling thread according to the specified flags until there are ...
QWidget * source() const
Definition: qdnd_p.h:230
STDMETHOD() QueryGetData(LPFORMATETC pformatetc)
Definition: qdnd_win.cpp:181
Qt::DropAction drag(QDrag *)
Definition: qdnd_mac.mm:530
#define QT_ENSURE_STACK_ALIGNED_FOR_SSE
Definition: qglobal.h:1176
STDMETHOD() QueryInterface(REFIID riid, void FAR *FAR *ppvObj)
Definition: qdnd_win.cpp:596
Q_CORE_EXPORT void qDebug(const char *,...)
ULONG m_refs
Definition: qdnd_p.h:133
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QWidget * widget
Definition: qdnd_p.h:302
bool isAccepted() const
Definition: qcoreevent.h:307
virtual ~QOleDataObject()
Definition: qdnd_win.cpp:85
int CF_PERFORMEDDROPEFFECT
Definition: qdnd_p.h:135
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QRect answerRect() const
Returns the rectangle in the widget where the drop will occur if accepted.
Definition: qevent.h:537
#define qApp
STDMETHOD_(ULONG, AddRef)(void)
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
void updatePixmap()
Definition: qdnd_mac.mm:696
QPoint lastPoint
Definition: qdnd_p.h:305
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
static Qt::DropActions possible_actions
Definition: qdnd_qws.cpp:79
static const char * data(const QByteArray &arr)
void releaseQt()
Definition: qdnd_win.cpp:585
Type
This enum type defines the types of variable that a QVariant can contain.
Definition: qvariant.h:95
void releaseQt()
Definition: qdnd_win.cpp:89
struct tagSTGMEDIUM STGMEDIUM
Definition: qmime.h:67
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
#define MK_XBUTTON2
Definition: qdnd_win.cpp:66
The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leav...
Definition: qevent.h:577
DropAction
Definition: qnamespace.h:1597
STDMETHOD() DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
Definition: qdnd_win.cpp:632
Qt::MouseButtons toQtMouseButtons(DWORD keyState)
Definition: qdnd_win.cpp:332
QPixmap pixmap() const
Returns the pixmap used to represent the data in a drag and drop operation.
Definition: qdrag.cpp:175
virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const =0
Convert the mimeData to the format specified in formatetc.
STDMETHOD() QueryInterface(REFIID riid, void **ppvObj)
Definition: qdnd_win.cpp:468
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
STDMETHOD() QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
Definition: qdnd_win.cpp:519
virtual ~QOleDropSource()
Definition: qdnd_win.cpp:379
bool acceptDrops
whether drop events are enabled for this widget
Definition: qwidget.h:197
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
STDMETHOD() EnumDAdvise(LPENUMSTATDATA FAR *ppenumAdvise)
Definition: qdnd_win.cpp:268
static QDragManager * self()
Definition: qdnd.cpp:163
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const
Definition: qdnd_mac.mm:229
static bool tryModalHelper(QWidget *widget, QWidget **rettop=0)
STDMETHOD() DAdvise(FORMATETC FAR *pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD FAR *pdwConnection)
Definition: qdnd_win.cpp:254
long HRESULT
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
Definition: qpoint.h:137
const QMimeData * mimeData() const
Definition: qdnd_win.cpp:94
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
Definition: qevent.h:476
#define MK_XBUTTON1
Definition: qdnd_win.cpp:65
static QWindowsMime * converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData)
Definition: qmime_win.cpp:355
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
LPDATAOBJECT currentDataObject
Definition: qdnd_p.h:202
QMimeData * data
Definition: qdnd_p.h:179
QMimeData * mimeData() const
Returns the MIME data that is encapsulated by the drag object.
Definition: qdrag.cpp:155
static bool acceptsDrop(const QWidget *w)
Definition: qdnd_win.cpp:693
STDMETHOD() GiveFeedback(DWORD dwEffect)
Definition: qdnd_win.cpp:551
QDropData * dropData
Definition: qdnd_p.h:251
The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action ent...
Definition: qevent.h:555
#define SM_CYCURSOR
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
Qt::DropAction currentAction
Definition: qdnd_win.cpp:365
static QWindowsMime * converterToMime(const QString &mimeType, IDataObject *pDataObj)
Definition: qmime_win.cpp:365
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
QRect rect() const
Returns the pixmap&#39;s enclosing rectangle.
Definition: qpixmap.cpp:676
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
virtual QVariant convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const =0
Returns a QVariant containing the converted data for mimeType from pDataObj.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
STDMETHOD() DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect)
Definition: qdnd_win.cpp:699
DWORD lastKeyState
Definition: qdnd_p.h:307
QOleDataObject(QMimeData *mimeData)
Definition: qdnd_win.cpp:77
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
Definition: qcoreevent.h:309
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QPixmap dragCursor(Qt::DropAction action) const
Definition: qdnd.cpp:170
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
DWORD chosenEffect
Definition: qdnd_p.h:306
void move(const QPoint &)
Definition: qdnd_mac.mm:283
STDMETHOD() GetCanonicalFormatEtc(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut)
Definition: qdnd_win.cpp:196
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
#define SM_CXCURSOR
bool hasCustomDragCursors() const
Definition: qdnd.cpp:188
void drop()
Definition: qdnd_mac.mm:287
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
Definition: qpoint.h:134
static QVector< FORMATETC > allFormatsForMime(const QMimeData *mimeData)
Definition: qmime_win.cpp:375
bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qdnd_mac.mm:263
QDragPrivate * dragPrivate() const
Definition: qdnd_p.h:231
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
void deleteLater()
Schedules this object for deletion.
Definition: qobject.cpp:2145
STDMETHOD() EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR *ppenumFormatEtc)
Definition: qdnd_win.cpp:218
static QWidget * dropWidget
STDMETHOD() QueryInterface(REFIID riid, void FAR *FAR *ppvObj)
Definition: qdnd_win.cpp:109
QPoint hotSpot() const
Returns the position of the hot spot relative to the top-left corner of the cursor.
Definition: qdrag.cpp:199
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
Definition: qdnd_mac.mm:259
Qt::KeyboardModifiers toQtKeyboardModifiers(DWORD keyState)
Definition: qdnd_win.cpp:318