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 <kevin.krammer@kdab.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
This commit is contained in:
Roger Maclean 2014-01-15 14:29:27 -05:00 committed by The Qt Project
parent 5fcee88097
commit 30e677e2bb

View File

@ -86,9 +86,18 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW
QQnxScreen *platformScreen = static_cast<QQnxScreen *>(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) {