diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index b8299e2cb8..049ec8373d 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -214,6 +214,8 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS
 
 QT_DEFINE_QPA_EVENT_HANDLER(void, handleEnterEvent, QWindow *window, const QPointF &local, const QPointF &global)
 {
+qDebug() << __FUNCTION__ << window << "local=" << QHighDpi::fromNativeLocalPosition(local, window)
+         << "global=" << QHighDpi::fromNativePixels(global, window);
     if (window) {
         QWindowSystemInterfacePrivate::EnterEvent *e
                 = new QWindowSystemInterfacePrivate::EnterEvent(window, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window));
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index d2f4161297..4c69bbd478 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2262,6 +2262,7 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
  */
 void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, const QPointF &globalPosF)
 {
+    qDebug() << __FUNCTION__ << "enter=" << enter << "leave=" << leave << "globalPosF=" << globalPosF;
 #if 0
     if (leave) {
         QEvent e(QEvent::Leave);
@@ -2341,6 +2342,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
             }
         }
     }
+    qDebug() << __FUNCTION__ <<  "enterList=" << enterList;
     if (!enterList.isEmpty()) {
         // Guard against QGuiApplicationPrivate::lastCursorPosition initialized to qInf(), qInf().
         const QPoint globalPos = qIsInf(globalPosF.x())
@@ -2351,6 +2353,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
             auto *w = *it;
             if (!QApplication::activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) {
                 const QPointF localPos = w->mapFromGlobal(globalPos);
+                qDebug() << __FUNCTION__ <<  "sending enter" << w;
                 QEnterEvent enterEvent(localPos, windowPos, globalPosF);
                 QApplication::sendEvent(w, &enterEvent);
                 if (w->testAttribute(Qt::WA_Hover) &&
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 79b4d67fdc..d4a3348540 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -11108,6 +11108,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
 {
     if (testAttribute(attribute) == on)
         return;
+    if (attribute == Qt::WA_Hover)
+        qDebug() << __FUNCTION__ << this << "hover!";
 
     Q_D(QWidget);
     Q_STATIC_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8),
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index abaebad821..fe3aaab28c 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -391,6 +391,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
     } else {
         const QEnterEvent *ee = static_cast<QEnterEvent *>(event);
         QWidget *child = m_widget->childAt(ee->pos());
+        qDebug() << __FUNCTION__ << ee->pos()  << "child" << child;
         QWidget *receiver = child ? child : m_widget.data();
         QWidget *leave = Q_NULLPTR;
         if (QApplicationPrivate::inPopupMode() && receiver == m_widget
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 2b6dc5f7e1..ac62a0f098 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -8862,9 +8862,36 @@ void tst_QWidget::maskedUpdate()
     QTRY_COMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update.
 }
 
+QRect geom(QObject *o)
+{
+    if (o->isWindowType())
+        return static_cast<QWindow *>(o)->geometry();
+    if (o->isWidgetType())
+        return static_cast<QWidget *>(o)->geometry();
+    return QRect();
+}
+
+class EF : public QObject {
+  public:
+    EF(QObject *p) : QObject(p) {}
+    bool eventFilter(QObject *watched, QEvent *event) override
+    {
+        if (event->type() == QEvent::Enter) {
+            QEnterEvent *ee = (QEnterEvent *)(event);
+            qDebug() << watched << ee->pos() << ee->globalPos()
+                     << "geom" << geom(watched) << QCursor::pos();
+            if (watched->objectName() == "Child")
+                qDebug("!!");
+        }
+        return false;
+    }
+};
+
 #ifndef QT_NO_CURSOR
 void tst_QWidget::syntheticEnterLeave()
 {
+    qApp->installEventFilter(new EF(qApp));
+
     if (m_platform == QStringLiteral("wayland"))
         QSKIP("Wayland: This fails. Figure out why.");
     class MyWidget : public QWidget
@@ -8877,6 +8904,7 @@ void tst_QWidget::syntheticEnterLeave()
         int numLeaveEvents;
     };
 
+
     QCursor::setPos(m_safeCursorPos);
 
     MyWidget window;
@@ -8885,15 +8913,18 @@ void tst_QWidget::syntheticEnterLeave()
     window.resize(200, 200);
 
     MyWidget *child1 = new MyWidget(&window);
+    child1->setObjectName("child1");
     child1->setPalette(Qt::blue);
     child1->setAutoFillBackground(true);
     child1->resize(200, 200);
     child1->setCursor(Qt::OpenHandCursor);
 
     MyWidget *child2 = new MyWidget(&window);
+    child2->setObjectName("child2");
     child2->resize(200, 200);
 
     MyWidget *grandChild = new MyWidget(child2);
+    grandChild->setObjectName("grandchild");
     grandChild->setPalette(Qt::red);
     grandChild->setAutoFillBackground(true);
     grandChild->resize(200, 200);
@@ -9000,13 +9031,18 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
      QCursor::setPos(m_safeCursorPos);
 
      SELParent parent;
+     parent.setObjectName("Parent");
      parent.move(200, 200);
      parent.resize(200, 200);
      SELChild child(&parent);
+     child.setObjectName("Child");
      child.resize(200, 200);
      parent.show();
      QVERIFY(QTest::qWaitForWindowActive(&parent));
 
+     qDebug() << "parent" <<parent.geometry() << "child" << child.geometry()
+              << "child.mapToGlobal100, 100" <<child.mapToGlobal(QPoint(100, 100));
+
      QCursor::setPos(child.mapToGlobal(QPoint(100, 100)));
      // Make sure the cursor has entered the child.
      QTRY_VERIFY(child.numEnterEvents > 0);
