QWidgetWindow: pass QPointF to QMouseEvent
QWidgetWindow::handleMouseEvent() passed a QPoint to QMouseEvent which might result in a wrong result on high-dpi displays. Since the incoming event has a correct QPointF coordinate, use this for the QMouseEvent Pick-to: 6.6 Fixes: QTBUG-106262 Change-Id: Idbfdab19220cb06aa0a28eef4e6ab4cab1035d97 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
90822833f3
commit
a5a925bf2e
@ -455,11 +455,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
|
||||
QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
|
||||
if (QApplicationPrivate::inPopupMode()) {
|
||||
QPointer<QWidget> activePopupWidget = QApplication::activePopupWidget();
|
||||
QPoint mapped = event->position().toPoint();
|
||||
QPointF mapped = event->position();
|
||||
if (activePopupWidget != m_widget)
|
||||
mapped = activePopupWidget->mapFromGlobal(event->globalPosition().toPoint());
|
||||
mapped = activePopupWidget->mapFromGlobal(event->globalPosition());
|
||||
bool releaseAfter = false;
|
||||
QWidget *popupChild = activePopupWidget->childAt(mapped);
|
||||
QWidget *popupChild = activePopupWidget->childAt(mapped.toPoint());
|
||||
|
||||
if (activePopupWidget != qt_popup_down) {
|
||||
qt_button_down = nullptr;
|
||||
@ -486,15 +486,15 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
|
||||
// deliver event
|
||||
qt_replay_popup_mouse_event = false;
|
||||
QPointer<QWidget> receiver = activePopupWidget;
|
||||
QPoint widgetPos = mapped;
|
||||
QPointF widgetPos = mapped;
|
||||
if (qt_button_down)
|
||||
receiver = qt_button_down;
|
||||
else if (popupChild)
|
||||
receiver = popupChild;
|
||||
if (receiver != activePopupWidget)
|
||||
widgetPos = receiver->mapFromGlobal(event->globalPosition().toPoint());
|
||||
widgetPos = receiver->mapFromGlobal(event->globalPosition());
|
||||
|
||||
const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped);
|
||||
const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped.toPoint());
|
||||
const bool underMouse = activePopupWidget->underMouse();
|
||||
if (underMouse != reallyUnderMouse) {
|
||||
if (reallyUnderMouse) {
|
||||
|
Loading…
Reference in New Issue
Block a user