Fix dnd regression c427ba53aa0ee1a71aa670783f65bcfd230da653
Qt starts drag-and-drop on a mouse button press event. Cococa in this case won't send the matching release event, so we have to synthesize it here. Task-number: QTBUG-72417 Change-Id: I645b6a2733c1ea11ac4545cf3405f826af45fa47 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
6288c12bb4
commit
a50b29d65b
@ -293,7 +293,26 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
|
||||
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
|
||||
nativeDrag->setAcceptedAction(qt_mac_mapNSDragOperation(operation));
|
||||
|
||||
// Qt starts drag-and-drop on a mouse button press event. Cococa in
|
||||
// this case won't send the matching release event, so we have to
|
||||
// synthesize it here.
|
||||
m_buttons = currentlyPressedMouseButtons();
|
||||
const auto modifiers = [QNSView convertKeyModifiers:NSApp.currentEvent.modifierFlags];
|
||||
|
||||
NSPoint windowPoint = [self.window convertRectFromScreen:NSMakeRect(screenPoint.x, screenPoint.y, 1, 1)].origin;
|
||||
NSPoint nsViewPoint = [self convertPoint: windowPoint fromView: nil];
|
||||
|
||||
QPoint qtWindowPoint(nsViewPoint.x, nsViewPoint.y);
|
||||
QPoint qtScreenPoint = QCocoaScreen::mapFromNative(screenPoint).toPoint();
|
||||
|
||||
QWindowSystemInterface::handleMouseEvent(
|
||||
target,
|
||||
mapWindowCoordinates(m_platformWindow->window(), target, qtWindowPoint),
|
||||
qtScreenPoint,
|
||||
m_buttons,
|
||||
Qt::NoButton,
|
||||
QEvent::MouseButtonRelease,
|
||||
modifiers);
|
||||
|
||||
qCDebug(lcQpaMouse) << "Drag session" << session << "ended, with" << m_buttons;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user