diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index b71a0c54aa..668b2d1b4e 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -337,6 +337,7 @@ void QWindow::setVisibility(Visibility v)
 void QWindowPrivate::setVisible(bool visible)
 {
     Q_Q(QWindow);
+    qDebug() << __FUNCTION__ <<  '>' <<  q;
 
     if (this->visible != visible) {
         this->visible = visible;
@@ -411,6 +412,7 @@ void QWindowPrivate::setVisible(bool visible)
         QHideEvent hideEvent;
         QGuiApplication::sendEvent(q, &hideEvent);
     }
+    qDebug() << __FUNCTION__ << '<' << q;
 }
 
 void QWindowPrivate::updateVisibility()
@@ -512,6 +514,7 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate)
 void QWindowPrivate::create(bool recursive, WId nativeHandle)
 {
     Q_Q(QWindow);
+    qDebug() << __FUNCTION__ << q << "recursive=" << recursive;
     if (platformWindow)
         return;
 
@@ -537,6 +540,7 @@ void QWindowPrivate::create(bool recursive, WId nativeHandle)
             continue;
 
         QWindow *childWindow = static_cast<QWindow *>(object);
+        qDebug() << __FUNCTION__ << q << "recursing=" << childWindow;
         if (recursive)
             childWindow->d_func()->create(recursive);
 
@@ -702,6 +706,8 @@ QWindow *QWindow::parent() const
 */
 void QWindow::setParent(QWindow *parent)
 {
+    qDebug() << __FUNCTION__ << this << "par=" << parent;
+
     parent = nonDesktopParent(parent);
 
     Q_D(QWindow);
@@ -879,6 +885,7 @@ QSurfaceFormat QWindow::format() const
 */
 void QWindow::setFlags(Qt::WindowFlags flags)
 {
+    qDebug() << __FUNCTION__ << this << flags;
     Q_D(QWindow);
     if (d->windowFlags == flags)
         return;
@@ -1881,11 +1888,13 @@ void QWindowPrivate::destroy()
         return;
 
     Q_Q(QWindow);
+    qDebug() << __FUNCTION__ << q ;
     QObjectList childrenWindows = q->children();
     for (int i = 0; i < childrenWindows.size(); i++) {
         QObject *object = childrenWindows.at(i);
         if (object->isWindowType()) {
             QWindow *w = static_cast<QWindow*>(object);
+            qDebug() << __FUNCTION__ << q << "recursing " << w;
             qt_window_private(w)->destroy();
         }
     }
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 9099805cf8..db2e6ad509 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1078,6 +1078,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
 void QWidgetPrivate::createRecursively()
 {
     Q_Q(QWidget);
+    qDebug() << __FUNCTION__ << q;
     q->create(0, true, true);
     for (int i = 0; i < children.size(); ++i) {
         QWidget *child = qobject_cast<QWidget *>(children.at(i));
@@ -1123,7 +1124,7 @@ QScreen *QWidgetPrivate::associatedScreen() const
 
     The parameters \a window, \a initializeWindow, and \a destroyOldWindow
     are ignored in Qt 5. Please use QWindow::fromWinId() to create a
-    QWindow wrapping a foreign window and pass it to
+    QWindow wrapping a foreign window and pass it t
     QWidget::createWindowContainer() instead.
 
     \sa createWindowContainer(), QWindow::fromWinId()
@@ -1135,6 +1136,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
     Q_UNUSED(destroyOldWindow);
 
     Q_D(QWidget);
+    qDebug() << __FUNCTION__ << this << "initializeWindow=" << initializeWindow << "destroyOldWindow" << destroyOldWindow;
     if (Q_UNLIKELY(window))
         qWarning("QWidget::create(): Parameter 'window' does not have any effect.");
     if (testAttribute(Qt::WA_WState_Created) && window == 0 && internalWinId())
@@ -2440,10 +2442,7 @@ Ensures that the widget has a window system identifier, i.e. that it is known to
 void QWidget::createWinId()
 {
     Q_D(QWidget);
-#ifdef ALIEN_DEBUG
     qDebug()  << "QWidget::createWinId" << this;
-#endif
-//    qWarning("QWidget::createWinId is obsolete, please fix your code.");
     d->createWinId();
 }
 
@@ -4060,6 +4059,8 @@ QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const
     if (parent) {
         const QWidget * w = this;
         while (w != parent) {
+            if (!w)
+                qDebug() << __FUNCTION__ << this << "par=" << parent << "assert!";
             Q_ASSERT_X(w, "QWidget::mapTo(const QWidget *parent, const QPoint &pos)",
                        "parent must be in parent hierarchy");
             p = w->mapToParent(p);
@@ -4159,9 +4160,17 @@ QWidget *QWidget::window() const
 */
 QWidget *QWidget::nativeParentWidget() const
 {
+    bool v = inherits("QQuickWidget");
+    if (v)
+        qDebug() << __FUNCTION__ << '>' << this;
     QWidget *parent = parentWidget();
-    while (parent && !parent->internalWinId())
+    while (parent && !parent->internalWinId()) {
+        if (v)
+            qDebug() << "  " << __FUNCTION__ << this << "loop" << parent;
         parent = parent->parentWidget();
+    }
+    if (v)
+        qDebug() << __FUNCTION__ << '<' << this << "rets" << parent;
     return parent;
 }
 
@@ -5422,6 +5431,9 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
                 sendPaintEvent(toBePainted);
             }
 
+            qDebug() << __FUNCTION__ << q << "vis=" << q->isVisible()
+                     << "winId=" << hex << q->internalWinId() << dec
+                     <<  "calling markNeedsFlush";
             if (repaintManager)
                 repaintManager->markNeedsFlush(q, toBePainted, offset);
 
@@ -8043,6 +8055,7 @@ void QWidgetPrivate::hide_sys()
 
 void QWidget::setVisible(bool visible)
 {
+    qDebug() << __FUNCTION__ << this << visible;
     if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden) == !visible)
         return;
 
@@ -8059,8 +8072,10 @@ void QWidget::setVisible(bool visible)
 void QWidgetPrivate::setVisible(bool visible)
 {
     Q_Q(QWidget);
+    qDebug() << __FUNCTION__ << q;
     if (visible) { // show
         // Designer uses a trick to make grabWidget work without showing
+        qDebug() << __FUNCTION__ << q << "creating?";
         if (!q->isWindow() && q->parentWidget() && q->parentWidget()->isVisible()
             && !q->parentWidget()->testAttribute(Qt::WA_WState_Created))
             q->parentWidget()->window()->d_func()->createRecursively();
@@ -8169,12 +8184,14 @@ void QWidgetPrivate::_q_showIfNotHidden()
 }
 
 void QWidgetPrivate::showChildren(bool spontaneous)
-{
+{    
     QList<QObject*> childList = children;
-    for (int i = 0; i < childList.size(); ++i) {
+    qDebug() << __FUNCTION__ << '>' << q_func() <<  childList;
+    for (int i = 0; i < childList.size(); ++i) {        
         QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
         if (widget && widget->windowHandle() && !widget->testAttribute(Qt::WA_WState_ExplicitShowHide))
             widget->setAttribute(Qt::WA_WState_Hidden, false);
+        qDebug() <<  "    " << __FUNCTION__ << "loop" << widget;
         if (!widget
             || widget->isWindow()
             || widget->testAttribute(Qt::WA_WState_Hidden))
@@ -8191,6 +8208,7 @@ void QWidgetPrivate::showChildren(bool spontaneous)
                 widget->show();
         }
     }
+    qDebug() << __FUNCTION__ << '<' << q_func();
 }
 
 void QWidgetPrivate::hideChildren(bool spontaneous)
@@ -10225,6 +10243,7 @@ void QWidget::updateGeometry()
 void QWidget::setWindowFlags(Qt::WindowFlags flags)
 {
     Q_D(QWidget);
+    qDebug() << __FUNCTION__ << flags;
     d->setWindowFlags(flags);
 }
 
@@ -10252,6 +10271,7 @@ void QWidget::setWindowFlag(Qt::WindowType flag, bool on)
 void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags)
 {
     Q_Q(QWidget);
+    qDebug() << __FUNCTION__ << q << flags;
     if (q->data->window_flags == flags)
         return;
 
@@ -10356,6 +10376,7 @@ static void sendWindowChangeToTextureChildrenRecursively(QWidget *widget)
 
 void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
 {
+    qDebug() << __FUNCTION__ << this << parent << f;
     Q_D(QWidget);
     Q_ASSERT_X(this != parent, Q_FUNC_INFO, "Cannot parent a QWidget to itself");
 #ifdef QT_DEBUG
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 596343c52f..9978fcdad1 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -72,6 +72,7 @@ public:
     void setVisible(bool visible) override
     {
         Q_Q(QWidgetWindow);
+        qDebug() << __FUNCTION__ <<  '>' <<  q;
         if (QWidget *widget = q->widget()) {
             // Check if the widget was already hidden, as this indicates it was done
             // explicitly and not because the parent window in this case made it hidden.
@@ -84,6 +85,7 @@ public:
         } else {
             QWindowPrivate::setVisible(visible);
         }
+        qDebug() << __FUNCTION__ <<  '<' <<  q;
     }
 
     QWindow *eventReceiver() override {
diff --git a/tests/manual/diaglib/diaglib.pri b/tests/manual/diaglib/diaglib.pri
index b57ee75841..b174fce747 100644
--- a/tests/manual/diaglib/diaglib.pri
+++ b/tests/manual/diaglib/diaglib.pri
@@ -12,7 +12,7 @@ HEADERS += \
 
 win32:!winrt:  {
     SOURCES += $$PWD/nativewindowdump_win.cpp
-    QMAKE_USE += user32
+    QMAKE_LIBS += -luser32
 } else {
     SOURCES += $$PWD/nativewindowdump.cpp
 }
