From 39a09526870e7cd0b27402aca817a71306dc5c41 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 8 Nov 2012 12:45:08 +0100 Subject: [PATCH] Send enter to the child at the position of the QEnterEvent. This was apparently done so in each of the widget_.cpp in Qt 4.8. This then causes the cursor to be updated in dispatchEnterLeave() on Windows and Linux. Task-number: QTBUG-27871 Task-number: QTBUG-27585 Task-number: QTBUG-26424 Change-Id: Idf14cd96ccb36f7c2607853ed8b0024c36a5413c Reviewed-by: Oliver Wolff Reviewed-by: Miikka Heikkinen --- src/widgets/kernel/qwidgetwindow.cpp | 6 ++++-- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index c11e363..056eabd 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -261,8 +261,10 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event) } } else { const QEnterEvent *ee = static_cast(event); - QApplicationPrivate::dispatchEnterLeave(m_widget, 0, ee->screenPos()); - qt_last_mouse_receiver = m_widget; + QWidget *child = m_widget->childAt(ee->pos()); + QWidget *receiver = child ? child : m_widget; + QApplicationPrivate::dispatchEnterLeave(receiver, 0, ee->screenPos()); + qt_last_mouse_receiver = receiver; } } diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index a70129c..548b5cc 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -8547,6 +8547,7 @@ void tst_QWidget::syntheticEnterLeave() MyWidget window; window.setWindowFlags(Qt::WindowStaysOnTopHint); + window.move(200, 200); window.resize(200, 200); MyWidget *child1 = new MyWidget(&window); @@ -8636,8 +8637,6 @@ void tst_QWidget::syntheticEnterLeave() #ifndef QTEST_NO_CURSOR void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() { - if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) - QSKIP("QTBUG-26424"); class SELParent : public QWidget { public: @@ -8665,6 +8664,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() QCursor::setPos(QPoint(0,0)); SELParent parent; + parent.move(200, 200); parent.resize(200, 200); SELChild child(&parent); child.resize(200, 200); -- 2.7.4