Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsdrag.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWINDOWSDRAG_H
5#define QWINDOWSDRAG_H
6
8
9#include <qpa/qplatformdrag.h>
10#include <QtGui/qpixmap.h>
11#include <QtGui/qdrag.h>
12#include <QtCore/private/qcomobject_p.h>
13
14struct IDropTargetHelper;
15
17
18class QPlatformScreen;
19
21public:
23 IDataObject *retrieveDataObject() const override;
24};
25
26class QWindowsOleDropTarget : public QComObject<IDropTarget>
27{
28public:
30 ~QWindowsOleDropTarget() override;
31
32 // IDropTarget methods
33 STDMETHOD(DragEnter)
34 (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
35 STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
36 STDMETHOD(DragLeave)() override;
37 STDMETHOD(Drop)
38 (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) override;
39
40private:
41 void handleDrag(QWindow *window, DWORD grfKeyState, const QPoint &, LPDWORD pdwEffect);
42
43 QWindow *const m_window;
44 QRect m_answerRect;
45 QPoint m_lastPoint;
46 DWORD m_chosenEffect = 0;
47 DWORD m_lastKeyState = 0;
48};
49
51{
52public:
54 virtual ~QWindowsDrag();
55
56 Qt::DropAction drag(QDrag *drag) override;
57
58 static QWindowsDrag *instance();
59 void cancelDrag() override { QWindowsDrag::m_canceled = true; }
60 static bool isCanceled() { return QWindowsDrag::m_canceled; }
61
62 IDataObject *dropDataObject() const { return m_dropDataObject; }
63 void setDropDataObject(IDataObject *dataObject) { m_dropDataObject = dataObject; }
66
67 IDropTargetHelper* dropHelper();
68
69private:
70 static bool m_canceled;
71
72 QWindowsDropMimeData m_dropData;
73 IDataObject *m_dropDataObject = nullptr;
74
75 IDropTargetHelper* m_cachedDropTargetHelper = nullptr;
76};
77
79
80#endif // QWINDOWSDRAG_H
\inmodule QtGui
Definition qdrag.h:22
\inmodule QtCore
Definition qmimedata.h:16
The QPlatformDrag class provides an abstraction for drag.
The QPlatformScreen class provides an abstraction for visual displays.
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtGui
Definition qwindow.h:63
Windows drag implementation.
IDataObject * dropDataObject() const
virtual ~QWindowsDrag()
static bool isCanceled()
QMimeData * dropData()
Return data for a drop in process.
void setDropDataObject(IDataObject *dataObject)
static QWindowsDrag * instance()
void releaseDropDataObject()
IDropTargetHelper * dropHelper()
May be used to handle extended cursors functionality for drags from outside the app.
Qt::DropAction drag(QDrag *drag) override
void cancelDrag() override
Cancels the currently active drag (only for drags of the current application initiated by QPlatformDr...
Special mime data class for data retrieval from Drag operations.
QWindowsDropMimeData()=default
IDataObject * retrieveDataObject() const override
Implementation of IDropTarget.
~QWindowsOleDropTarget() override
LPDATAOBJECT DWORD grfKeyState
LPDATAOBJECT DWORD POINTL pt
QWindowsOleDropTarget(QWindow *w)
LPDATAOBJECT pDataObj
STDMETHOD DragLeave() override
Combined button and popup list for selecting options.
DropAction
GLfloat GLfloat GLfloat w
[0]
aWidget window() -> setWindowTitle("New Window Title")
[2]