Verify that QWindow::fromWinId returned a QWindow before using it
Foreign window support is not available on all platforms. E.g. on Wayland this returns a nullptr. Thus we cannot use it.
REVIEW: 128260