diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-12-11 14:35:48 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-30 13:29:28 +0100 |
commit | 18b7015e86bf621df1f54beb474d67123e18f0ae (patch) | |
tree | 297a95752e1869e7a9545c3882c9aa8d5ec9c3a5 /src/gui/kernel/qwindow.cpp | |
parent | 848c5d01e2ed63f8d8b853db028da4484a1d2e2a (diff) |
Add QWindowPrivate::topLevelWindow() helper function
Might be useful to expose to QWindow in 5.3, but for now it's private
so it can be used by platform plugins.
Change-Id: Iad96d7e249a7b85695668f8d7e8918164ec67442
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 2e1d8f9976..4c74a0b834 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2147,6 +2147,26 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed() } +QWindow *QWindowPrivate::topLevelWindow() const +{ + Q_Q(const QWindow); + + QWindow *window = const_cast<QWindow *>(q); + + while (window) { + QWindow *parent = window->parent(); + if (!parent) + parent = window->transientParent(); + + if (!parent) + break; + + window = parent; + } + + return window; +} + /*! Creates a local representation of a window created by another process or by using native libraries below Qt. |