From 215594d664f6fc7057468a05a59344f08a78a976 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 14 Oct 2020 23:40:34 +0200 Subject: Purge QDesktopWidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's no longer used; the only calls to QApplicationPrivate::desktop pass the default nullptr for QScreen, so all we need is a Qt::Desktop type toplevel widget. Include changes documentation about both the class and QApplication::desktop being gone in Qt 6. Change-Id: I22d6e93cabc6aaaefffe5e96942886a2ef4e0609 Reviewed-by: Tor Arne Vestbø --- src/widgets/kernel/qapplication.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'src/widgets/kernel/qapplication.cpp') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 41b3dd9aca..ed6414b16f 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -42,7 +42,6 @@ #include "qapplication.h" #include "qclipboard.h" #include "qcursor.h" -#include "qdesktopwidget_p.h" #include "qdir.h" #include "qevent.h" #include "qfile.h" @@ -378,7 +377,7 @@ FontHash *qt_app_fonts_hash() { return app_fonts(); } QWidgetList *QApplicationPrivate::popupWidgets = nullptr; // has keyboard input focus -QDesktopWidget *qt_desktopWidget = nullptr; // root window widgets +QWidget *qt_desktopWidget = nullptr; // root window widgets /*! \internal @@ -2510,31 +2509,21 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) } /*! - \obsolete - - Returns the desktop widget (also called the root window) for \a screen. - - If \a screen is nullptr, then the widget that represents the entire virtual - desktop is returned, and its geometry will be the union of all screens. + \internal - Use the desktop widget for a specific screen as the parent of a new toplevel - widget to position the widget on a specific screen. + Returns the desktop widget (also called the root window). - The desktop may be composed of multiple screens, so it would be incorrect, - for example, to attempt to \e center some widget in the desktop's geometry. - Use QScreen::geometry() and QScreen::availableGeometry() to get the dimensions - of a specific screen instead. + The widget represents the entire virtual desktop, and its geometry will + be the union of all screens. */ -QWidget *QApplicationPrivate::desktop(QScreen *screen) +QWidget *QApplicationPrivate::desktop() { CHECK_QAPP_INSTANCE(nullptr) if (!qt_desktopWidget || // not created yet !(qt_desktopWidget->windowType() == Qt::Desktop)) { // reparented away - qt_desktopWidget = new QDesktopWidget(); + qt_desktopWidget = new QWidget(nullptr, Qt::Desktop); } - if (!screen) - return qt_desktopWidget; - return qt_desktopWidget->widgetForScreen(screen); + return qt_desktopWidget; } /* -- cgit v1.2.3