21#include <QtCore/QEventLoop>
22#include <QtCore/QDebug>
23#include <QtCore/QLoggingCategory>
25#include <private/qguiapplication_p.h>
26#include <private/qdnd_p.h>
28#include <private/qshapedpixmapdndwindow_p.h>
29#include <private/qhighdpiscaling_p.h>
41 if (
w->isVisible() &&
w->handle() &&
w->geometry().contains(
pos) && !qobject_cast<QShapedPixmapWindow*>(
w))
66 delete m_drag_icon_window;
69void QBasicDrag::enableEventFilter()
71 qApp->installEventFilter(
this);
74void QBasicDrag::disableEventFilter()
76 qApp->removeEventFilter(
this);
110 disableEventFilter();
123 move(m_lastPos, mouseMove->buttons(), mouseMove->modifiers());
128 QPointer<QObject> objGuard(
o);
129 disableEventFilter();
133 drop(nativePosition, mouseRelease->buttons(), mouseRelease->modifiers());
148 qCDebug(lcDnd) <<
"mouse released over" << releaseWindow <<
"after drag from" <<
m_sourceWindow <<
"globalPos" <<
release->globalPosition().toPoint();
151 QPointF releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(
release->globalPosition()) :
release->globalPosition());
153 releaseWindowPos, releaseWindowPos,
release->globalPosition(),
178 m_eventLoop =
nullptr;
182 return m_executed_drop_action;
214 delete m_drag_icon_window;
228 disableEventFilter();
246 disableEventFilter();
251void QBasicDrag::exitDndEventLoop()
253 if (m_eventLoop && m_eventLoop->
isRunning())
277 if (!m_dndHasSetOverrideCursor) {
280 m_dndHasSetOverrideCursor =
true;
298void QBasicDrag::restoreCursor()
301 if (m_dndHasSetOverrideCursor) {
303 m_dndHasSetOverrideCursor =
false;
310#ifndef QT_NO_HIGHDPISCALING
314 if (
s->handle()->geometry().contains(point)) {
398 const QPoint pos = nativeGlobalPos -
window->handle()->geometry().topLeft();
417 const QPoint pos = nativeGlobalPos -
window->handle()->geometry().topLeft();
void updateCursor(Qt::DropAction action)
void moveShapedPixmapWindow(const QPoint &deviceIndependentPosition)
Move the drag label to globalPos, which is interpreted in device independent coordinates.
void cancelDrag() override
Cancels the currently active drag (only for drags of the current application initiated by QPlatformDr...
virtual bool eventFilter(QObject *o, QEvent *e) override
Filters events if this object has been installed as an event filter for the watched object.
virtual void drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods)=0
void recreateShapedPixmapWindow(QScreen *screen, const QPoint &pos)
void setExecutedDropAction(Qt::DropAction da)
QPointer< QWindow > m_windowUnderCursor
virtual void move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods)=0
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
The QCursor class provides a mouse cursor with an arbitrary shape.
QPixmap pixmap() const
Returns the cursor pixmap.
Qt::CursorShape shape() const
Returns the cursor shape identifier.
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
QPixmap pixmap() const
Returns the pixmap used to represent the data in a drag and drop operation.
QPixmap dragCursor(Qt::DropAction action) const
Returns the drag cursor for the action.
QPoint hotSpot() const
Returns the position of the hot spot relative to the top-left corner of the cursor.
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
void exit(int returnCode=0)
Tells the event loop to exit with a return code.
bool isRunning() const
Returns true if the event loop is running; otherwise returns false.
void quit()
Tells the event loop to exit normally.
Type type() const
Returns the event type.
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
static QList< QScreen * > screen_list
static QWindowList topLevelWindows()
Returns a list of the top-level windows in the application.
static QCursor * overrideCursor()
Returns the active application override cursor.
static void changeOverrideCursor(const QCursor &)
Changes the currently active application override cursor to cursor.
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
static void setOverrideCursor(const QCursor &)
Sets the application override cursor to cursor.
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
static Qt::MouseButtons mouseButtons()
Returns the current state of the buttons on the mouse.
The QKeyEvent class describes a key event.
int key() const
Returns the code of the key that was pressed or released.
const_reverse_iterator crbegin() const noexcept
const_reverse_iterator crend() const noexcept
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
qint64 cacheKey() const
Returns a number that identifies this QPixmap.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QScreen class is used to query screen properties. \inmodule QtGui.
void setHotspot(const QPoint &hotspot)
void updateGeometry(const QPoint &pos)
void setUseCompositing(bool on)
void setPixmap(const QPixmap &pixmap)
virtual void cancel() override
virtual void drop(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override
virtual void move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods) override
virtual void startDrag() override
void setVisible(bool visible)
EGLImageKHR int int EGLuint64KHR * modifiers
QSet< QString >::iterator it
T toNativePixels(const T &value, const C *context)
T fromNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf()
GLfloat GLfloat GLfloat w
[0]
static QPoint fromNativeGlobalPixels(const QPoint &point)
static void sendDragLeave(QWindow *window)
static QPoint getNativeMousePos(QEvent *e, QWindow *window)
static QT_BEGIN_NAMESPACE QWindow * topLevelAt(const QPoint &pos)