Fix qtwindow (2.4)

PR https://github.com/Itseez/opencv/pull/909 rebased onto 2.4