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>
}
+ // 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);