From 10a3b10726d2f46b2a284ecb7533bb9226f8c7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 16 May 2011 17:28:56 +0200 Subject: Re-implement transient window support in XCB backend. If a QWindow has a parent but is top-level the corresponding QPlatformWindow should not be re-parented but instead be made transient for the parent window if possible. --- src/gui/kernel/qwindow.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gui/kernel/qwindow.cpp') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 5d4fd763b8..3b01a0d352 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -97,7 +97,7 @@ void QWindow::create() QObject *object = childObjects.at(i); if(object->isWindowType()) { QWindow *window = static_cast(object); - if (window->d_func()->platformWindow) + if (window->d_func()->platformWindow && !window->isTopLevel()) window->d_func()->platformWindow->setParent(d->platformWindow); } } @@ -133,9 +133,9 @@ void QWindow::setParent(QWindow *parent) QObject::setParent(parent); if (d->platformWindow) { - if (parent && parent->d_func()->platformWindow) { + if (parent && parent->d_func()->platformWindow && !isTopLevel()) { d->platformWindow->setParent(parent->d_func()->platformWindow); - } else if (!parent) { + } else { d->platformWindow->setParent(0); } } @@ -144,12 +144,12 @@ void QWindow::setParent(QWindow *parent) } /*! - Returns whether the window is top level, i.e. parent-less. + Returns whether the window is top level. */ bool QWindow::isTopLevel() const { Q_D(const QWindow); - return d->parentWindow == 0; + return d->windowFlags & Qt::Window; } void QWindow::setWindowFormat(const QWindowFormat &format) @@ -196,6 +196,12 @@ Qt::WindowFlags QWindow::windowFlags() const return d->windowFlags; } +Qt::WindowType QWindow::windowType() const +{ + Q_D(const QWindow); + return static_cast(int(d->windowFlags & Qt::WindowType_Mask)); +} + void QWindow::setWindowTitle(const QString &title) { Q_D(QWindow); -- cgit v1.2.3