From a8dd18252c4c8027e8c7956f3c5428b56014445b Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 13 Oct 2020 21:02:39 +0200 Subject: [PATCH] Remove QApplication::desktop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's been replaced with QScreen-based APIs. There's some internal code left depending on a QWidget representing a screen, so move the API into QApplicationPrivate until that's cleaned up as well. Change-Id: I851e0901832f2747af3bf2c16a9c4d815598bd08 Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qapplication.cpp | 6 +++--- src/widgets/kernel/qapplication.h | 2 -- src/widgets/kernel/qapplication_p.h | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index bb43812619..be37182ccd 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1567,7 +1567,7 @@ QWidget *QApplication::activeWindow() QFontMetrics QApplication::fontMetrics() { - return desktop()->fontMetrics(); + return QApplicationPrivate::desktop()->fontMetrics(); } bool QApplicationPrivate::tryCloseAllWidgetWindows(QWindowList *processedWindows) @@ -2107,7 +2107,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con if (!parentOfLeavingCursor->window()->graphicsProxyWidget()) #endif { - if (enter == QApplication::desktop()) { + if (enter == QApplicationPrivate::desktop()) { qt_qpa_set_cursor(enter, true); } else { qt_qpa_set_cursor(parentOfLeavingCursor, true); @@ -2522,7 +2522,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) Use QScreen::geometry() and QScreen::availableGeometry() to get the dimensions of a specific screen instead. */ -QWidget *QApplication::desktop(QScreen *screen) +QWidget *QApplicationPrivate::desktop(QScreen *screen) { CHECK_QAPP_INSTANCE(nullptr) if (!qt_desktopWidget || // not created yet diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 36a7576c2d..52304c637a 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -105,8 +105,6 @@ public: static QWidgetList allWidgets(); static QWidgetList topLevelWidgets(); - static QWidget *desktop(QScreen *screen = nullptr); - static QWidget *activePopupWidget(); static QWidget *activeModalWidget(); static QWidget *focusWidget(); diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 354cac0c9a..c5c3f2f393 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -113,7 +113,7 @@ public: void createEventDispatcher() override; static void dispatchEnterLeave(QWidget *enter, QWidget *leave, const QPointF &globalPosF); - + static QWidget *desktop(QScreen *screen = nullptr); void notifyWindowIconChanged() override; #ifndef QT_NO_ACTION