Correctly set native widget window visibility

After d7a9e08f, calling QWindow::setVisible(true)
is a no-op if the widget is already visible.

Use QWidgetWindow::setNativeWindowVisibility() instead
to set visibility for the native window directly.

“Upgrading” widgets to be native widgets now works
again.

Change-Id: Id68dd8241f3afe00670c07e30e2b2ade9c150354
Task-number: QTBUG-61006
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2017-05-29 13:20:11 +02:00
parent 3ee6d8d336
commit e3bdad13be

View File

@ -1516,7 +1516,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
q->setAttribute(Qt::WA_OutsideWSRange, true);
} else if (q->isVisible()) {
// If widget is already shown, set window visible, too
win->setVisible(true);
QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(win);
widgetWindow->setNativeWindowVisibility(true);
}
}