Make QMacCocoaViewContainer work again

The widget visibility state was set to explicitly hidden,
which was preventing it from working correctly when
its parent widget was shown.

This regression was introduced by commit d7a9e08,
which made QWindow::setVisible() call QWidget::setVisible().

QWindow::destroy() calls QWindow::setVisible(false),
which means that the destroy() call in setCocoaView()
would set the CoocaViewContainer to be explicitly hidden.

Clear WA_WState_Hidden to work around this behavior.

Task-number: QTBUG-67504
Change-Id: I77438fcd01f165f058eea178c214838bd4f27084
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2018-08-17 09:47:59 +02:00
parent 4e4057460a
commit d615fb39d5

View File

@ -165,6 +165,11 @@ void QMacCocoaViewContainer::setCocoaView(NSView *view)
Q_ASSERT(window->handle());
[oldView release];
// The QWindow::destroy()) call above will explicitly hide this widget.
// Clear the hidden state here so it can be implicitly shown again.
setAttribute(Qt::WA_WState_Hidden, false);
}
QT_END_NAMESPACE