diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 683285011f5..6131491aaa1 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1401,9 +1401,12 @@ void QWidgetPrivate::create() if (data.crect.width() == 0 || data.crect.height() == 0) { q->setAttribute(Qt::WA_OutsideWSRange, true); - } else if (q->isVisible()) { - // If widget is already shown, set window visible, too - win->setNativeWindowVisibility(true); + } else { + q->setAttribute(Qt::WA_OutsideWSRange, false); + if (q->isVisible()) { + // If widget is already shown, set window visible, too + win->setNativeWindowVisibility(true); + } } }