Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
16QT_BEGIN_NAMESPACE
17
18class QPlatformScreen;
19
21public:
23 IDataObject *retrieveDataObject() const override;
24};
25
27{
28public:
29 explicit QWindowsOleDropTarget(QWindow *w);
31
32 // IDropTarget methods
33 STDMETHOD(DragEnter)
34 (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) noexcept override;
35 STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) noexcept override;
36 STDMETHOD(DragLeave)() noexcept override;
37 STDMETHOD(Drop)
38 (LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) noexcept 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
78QT_END_NAMESPACE
79
80#endif // QWINDOWSDRAG_H
\inmodule QtCore\reentrant
Definition qpoint.h:29
Singleton container for all relevant information.
QWindowsScreenManager & screenManager()
static QWindowsContext * instance()
Platform cursor implementation.
static QPoint mousePosition()
static State cursorState()
A toplevel window showing the drag icon in case of touch drag.
void setPixmap(const QPixmap &p)
void paintEvent(QPaintEvent *) override
Handles paint events passed in the event parameter.
QWindowsDragCursorWindow(QWindow *parent=nullptr)
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...
QWindowsOleDataObject subclass specialized for handling Drag&Drop.
QWindowsDropDataObject(QMimeData *mimeData)
Special mime data class for data retrieval from Drag operations.
QWindowsDropMimeData()=default
IDataObject * retrieveDataObject() const override
static QWindowsIntegration * instance()
Implementation of IDropSource.
STDMETHOD GiveFeedback(DWORD dwEffect) noexcept override
Give feedback: Change cursor according to action.
~QWindowsOleDropSource() override
void createCursors()
Blend custom pixmap with cursors.
QWindowsOleDropSource(QWindowsDrag *drag)
STDMETHOD QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) noexcept override
Check for cancel.
Implementation of IDropTarget.
~QWindowsOleDropTarget() override
LPDATAOBJECT DWORD grfKeyState
STDMETHOD DragLeave() noexcept override
LPDATAOBJECT DWORD POINTL pt
QWindowsOleDropTarget(QWindow *w)
STDMETHOD DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) noexcept override
LPDATAOBJECT pDataObj
const QWindowsScreen * screenAtDp(const QPoint &p) const
Raster or OpenGL Window.
bool hasMouseCapture() const
#define WM_POINTERUPDATE
#define WM_POINTERLEAVE
static HRESULT startDoDragDrop(LPDATAOBJECT pDataObj, LPDROPSOURCE pDropSource, DWORD dwOKEffects, LPDWORD pdwEffect)
static Qt::DropActions translateToQDragDropActions(DWORD pdwEffects)
static Qt::KeyboardModifiers toQtKeyboardModifiers(DWORD keyState)
static Qt::MouseButtons lastButtons
static Qt::DropAction translateToQDragDropAction(DWORD pdwEffect)
static DWORD translateToWinDragEffects(Qt::DropActions action)
static Qt::KeyboardModifiers lastModifiers