summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-12-11 14:35:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-30 13:29:28 +0100
commit18b7015e86bf621df1f54beb474d67123e18f0ae (patch)
tree297a95752e1869e7a9545c3882c9aa8d5ec9c3a5 /src/gui/kernel
parent848c5d01e2ed63f8d8b853db028da4484a1d2e2a (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')
-rw-r--r--src/gui/kernel/qwindow.cpp20
-rw-r--r--src/gui/kernel/qwindow_p.h2
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();