Fix setParent_sys() to use native methods when checking for toplevel

QWindowsWindow::setParent_sys() was checking if window was toplevel
using non-native method, which caused wrong result in some cases
involving native windows. Changed the toplevel check to utilize
native method instead.

Task-number: QTBUG-26826
Change-Id: I72ca17c53c1ed7611f141cee17b2edaaa80c6c17
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
bb10
Miikka Heikkinen 2012-08-16 13:03:32 +03:00 committed by Qt by Nokia
parent 30f3432845
commit 0d897a7fb6
1 changed files with 8 additions and 1 deletions

View File

@ -903,8 +903,15 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const
}
// NULL handle means desktop window, which also has its proper handle -> disambiguate
HWND desktopHwnd = GetDesktopWindow();
if (oldParentHWND == desktopHwnd)
oldParentHWND = 0;
if (newParentHWND == desktopHwnd)
newParentHWND = 0;
if (newParentHWND != oldParentHWND) {
const bool wasTopLevel = window()->isTopLevel();
const bool wasTopLevel = oldParentHWND == 0;
const bool isTopLevel = newParentHWND == 0;
setFlag(WithinSetParent);