QNX: Only set parent window if it is not NULL

There are cases where a widget has a parent, but is also a toplevel window at
the same time, causing the system window to have no parent.
For instance, a QMenu usually has a QMenuBar as a parent, however QMenuBar
itself does not have its own platform window, as opposed to QMenu. Thus
QMenuBar::parent == QMainWindow (for example), but QMenuBar::platformWindow ==
0x0; QMenu::parent == QMenuBar, but QMenu::platformWindow != 0x0 (which is
QMenuBar's value).

Change-Id: Ib203fa1b85f5f20ef53366c80d6752d6384a202d
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
Rafael Roquetto 2012-09-27 18:24:16 -03:00 committed by The Qt Project
parent 1511fb37cf
commit 04d296d641

View File

@ -138,7 +138,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
// Qt never calls these setters after creating the window, so we need to do that ourselves here
setWindowState(window->windowState());
if (window->parent())
if (window->parent() && window->parent()->handle())
setParent(window->parent()->handle());
setGeometryHelper(window->geometry());
setVisible(window->isVisible());