diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-07-18 09:09:16 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-07-18 12:10:56 +0200 |
commit | f547381806f6251c176e587d6d95b66bb8dfa88c (patch) | |
tree | a43f955b021ff4ead4dfa5724ecdcf0eb044617b /src | |
parent | fe099b63837d0ea93db0abf8894139271a01ee05 (diff) |
Implement QApplication::topLevelAt() using QGuiApplication::topLevelAt().
Reducing code duplication, preparing for High-DPI support.
Task-number: QTBUG-38858
Change-Id: Id0ed12db4b5cadd0eef79afd0ac62f58a7b01901
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6329c52caa..cac5e72f39 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -377,16 +377,9 @@ void QApplicationPrivate::createEventDispatcher() */ QWidget *QApplication::topLevelAt(const QPoint &pos) { - QList<QScreen *> screens = QGuiApplication::screens(); - QList<QScreen *>::const_iterator screen = screens.constBegin(); - QList<QScreen *>::const_iterator end = screens.constEnd(); - - while (screen != end) { - if ((*screen)->geometry().contains(pos)) { - QWidgetWindow *w = qobject_cast<QWidgetWindow *>((*screen)->handle()->topLevelAt(pos)); - return w ? w->widget() : 0; - } - ++screen; + if (const QWindow *window = QGuiApplication::topLevelAt(pos)) { + if (const QWidgetWindow *widgetWindow = qobject_cast<const QWidgetWindow *>(window)) + return widgetWindow->widget(); } return 0; } |