diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 2 |
2 files changed, 22 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. diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 8d8fca3ce6..8ebbf5d508 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -122,6 +122,8 @@ public: return offset; } + QWindow *topLevelWindow() const; + virtual QWindow *eventReceiver() { Q_Q(QWindow); return q; } void updateVisibility(); |