Port away from qWaitForWindowShown.