From 30e677e2bb21f45bbb3bc538d6c02f20dbbdfb11 Mon Sep 17 00:00:00 2001 From: Roger Maclean Date: Wed, 15 Jan 2014 14:29:27 -0500 Subject: QNX: Allow creation of parentless child windows There is no reason why a parentless window from a Qt perspective needs to be a screen application window. There are some cases, such as the BB10 dialog service whose windows are always parented by a window in another process. Ideally one would have a means to indicate a child window was wanted that had no other side effect (i.e. the rest of Qt would ignore). The use of Qt::Dialog is not ideal as some code does pay attention to this type given the number of bits available for window type, it is not reasonable to add a new one. The use of Qt::Dialog seems safe since it is hard to conceive of a window of type Qt::Dialog wanting to be a top level window. If in future it is required to have a parentless, child window that is not of type Qt::Dialog one can simply define some additional way of signalling this. Change-Id: Ie7035980ac2efd5bc722a8371c834f21ea7755f4 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto Reviewed-by: Fabian Bumberger --- src/plugins/platforms/qnx/qqnxwindow.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index e782db75eb..e28e5f40e5 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -86,9 +86,18 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW QQnxScreen *platformScreen = static_cast(window->screen()->handle()); - m_isTopLevel = ( needRootWindow && !platformScreen->rootWindow()) - || (!needRootWindow && !parent()) - || window->type() == Qt::CoverWindow; + if (window->type() == Qt::CoverWindow) { + // Cover windows have to be top level to be accessible to window delegate (i.e. navigator) + m_isTopLevel = true; + } else if (parent() || (window->type() & Qt::Dialog) == Qt::Dialog) { + // If we have a parent we are a child window. Sometimes we have to be a child even if we + // don't have a parent e.g. our parent might be in a different process. + m_isTopLevel = false; + } else { + // We're parentless. If we're not using a root window, we'll always be a top-level window + // otherwise only the first window is. + m_isTopLevel = !needRootWindow || !platformScreen->rootWindow(); + } errno = 0; if (m_isTopLevel) { -- cgit v1.2.3