Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.0
-
None
-
Winows 10 x64
Visual Studio 2017
-
-
00cfb4d7801ec9b5d9b070879ef4a962390628b7 (qt/qtbase/5.12)
Description
Drag and drop inside the same window works as expected. But when I drag the item outside the window (like onto the desktop, console, etc), the mouse release event is not sent. The item sticks to the mouse cursor if the mouse is moved back into the window. Probably because of the missing release event.
I have looked into the source code and found this line:
http://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/windows/qwindowsdrag.cpp?h=5.12#n406
Commenting it out resolved the issue, but is probably not the cause. I have looked further and found QWindowsOleDropTarget::DragLeave which is more likely to be the root cause:
http://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/windows/qwindowsdrag.cpp?h=5.12#n575
It resets QGuiApplicationPrivate::mouse_buttons to Qt::NoButton. I have changed the line to this:
QWindowSystemInterface::handleDrag(m_window, 0, QPoint(), Qt::IgnoreAction, QGuiApplicationPrivate::mouse_buttons, QGuiApplicationPrivate::modifier_buttons);
And it works as expected. I am no expert, so I am not sure if this should be the default.