macOS: Don't set opacity on non-top level windows during NSWindow creation

The opacity is a property of NSWindow.

There's no point in pulling out the opacity from QWindowPrivate,
as QWindow has a public accessor for it. And we don't need to
guard the call with a check for non-1.0 opacity. If we want
logic to avoid redundant calls to the platform APIs, they
should be in the setter.

Pick-to: 6.5
Change-Id: Ic9b8d1051f30d3b7e09dae14b9f22ca899d05865
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-03-07 12:27:33 +01:00
parent 4ec5c0efc7
commit d7e2c9acf2

View File

@ -1524,16 +1524,13 @@ void QCocoaWindow::recreateWindowIfNeeded()
setWindowTitle(window()->title());
setWindowFilePath(window()->filePath()); // Also sets window icon
setWindowState(window()->windowState());
setOpacity(window()->opacity());
} else {
// Child windows have no NSWindow, re-parent to superview instead
[parentCocoaWindow->m_view addSubview:m_view];
[m_view setHidden:!window()->isVisible()];
}
const qreal opacity = qt_window_private(window())->opacity;
if (!qFuzzyCompare(opacity, qreal(1.0)))
setOpacity(opacity);
setMask(QHighDpi::toNativeLocalRegion(window()->mask(), window()));
}