summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/.prev_CMakeLists.txt1
-rw-r--r--src/widgets/CMakeLists.txt1
-rw-r--r--src/widgets/doc/src/qt6-changes.qdoc14
-rw-r--r--src/widgets/kernel/kernel.pri2
-rw-r--r--src/widgets/kernel/qapplication.cpp27
-rw-r--r--src/widgets/kernel/qapplication_p.h2
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp123
-rw-r--r--src/widgets/kernel/qdesktopwidget_p.h91
8 files changed, 22 insertions, 239 deletions
diff --git a/src/widgets/.prev_CMakeLists.txt b/src/widgets/.prev_CMakeLists.txt
index f2d3448e0d..99792726ee 100644
--- a/src/widgets/.prev_CMakeLists.txt
+++ b/src/widgets/.prev_CMakeLists.txt
@@ -12,7 +12,6 @@ qt_internal_add_module(Widgets
itemviews/qfileiconprovider.cpp itemviews/qfileiconprovider.h itemviews/qfileiconprovider_p.h
kernel/qapplication.cpp kernel/qapplication.h kernel/qapplication_p.h
kernel/qboxlayout.cpp kernel/qboxlayout.h
- kernel/qdesktopwidget.cpp kernel/qdesktopwidget_p.h
kernel/qgesture.cpp kernel/qgesture.h kernel/qgesture_p.h
kernel/qgesturemanager.cpp kernel/qgesturemanager_p.h
kernel/qgesturerecognizer.cpp kernel/qgesturerecognizer.h
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 1e18191014..e1e7dd968a 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -12,7 +12,6 @@ qt_internal_add_module(Widgets
itemviews/qfileiconprovider.cpp itemviews/qfileiconprovider.h itemviews/qfileiconprovider_p.h
kernel/qapplication.cpp kernel/qapplication.h kernel/qapplication_p.h
kernel/qboxlayout.cpp kernel/qboxlayout.h
- kernel/qdesktopwidget.cpp kernel/qdesktopwidget_p.h
kernel/qgesture.cpp kernel/qgesture.h kernel/qgesture_p.h
kernel/qgesturemanager.cpp kernel/qgesturemanager_p.h
kernel/qgesturerecognizer.cpp kernel/qgesturerecognizer.h
diff --git a/src/widgets/doc/src/qt6-changes.qdoc b/src/widgets/doc/src/qt6-changes.qdoc
index 4f0379a2f6..47e02dc6c9 100644
--- a/src/widgets/doc/src/qt6-changes.qdoc
+++ b/src/widgets/doc/src/qt6-changes.qdoc
@@ -41,6 +41,18 @@
In this topic we summarize those changes in Qt Widgets, and provide
guidance to handle them.
- \section1 ADD STUFF HERE
+ \section1 Kernel classes
+ \section2 QDesktopWidget and QApplication::desktop()
+
+ QDesktopWidget was already deprecated in Qt 5, and has been removed in
+ Qt 6, together with QApplication::desktop().
+
+ QScreen provides equivalent functionality to query for information about
+ available screens, screen that form a virtual desktop, and screen
+ geometries.
+
+ Use QWidget::setScreen() to create a QWidget on a specific display;
+ note that this does not move a widget to a screen in a virtual desktop
+ setup.
*/
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index b00e220078..85a388009e 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -25,7 +25,6 @@ HEADERS += \
kernel/qstandardgestures_p.h \
kernel/qgesturerecognizer.h \
kernel/qgesturemanager_p.h \
- kernel/qdesktopwidget_p.h \
kernel/qwidgetwindow_p.h \
kernel/qwindowcontainer_p.h \
kernel/qtestsupport_widgets.h
@@ -45,7 +44,6 @@ SOURCES += \
kernel/qstandardgestures.cpp \
kernel/qgesturerecognizer.cpp \
kernel/qgesturemanager.cpp \
- kernel/qdesktopwidget.cpp \
kernel/qwidgetsvariant.cpp \
kernel/qwidgetwindow.cpp \
kernel/qwindowcontainer.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;
}
/*
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index c5c3f2f393..af89244d57 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);
+ static QWidget *desktop();
void notifyWindowIconChanged() override;
#ifndef QT_NO_ACTION
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
deleted file mode 100644
index 5c781222e1..0000000000
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglobal.h"
-#include "qdesktopwidget_p.h"
-#include "qscreen.h"
-#include "qwidget_p.h"
-#include "qwindow.h"
-
-#include <private/qhighdpiscaling_p.h>
-#include <qpa/qplatformscreen.h>
-
-QT_BEGIN_NAMESPACE
-
-QDesktopWidgetPrivate::~QDesktopWidgetPrivate()
-{
- qDeleteAll(screenWidgets.values());
-}
-
-void QDesktopWidgetPrivate::updateScreens()
-{
- Q_Q(QDesktopWidget);
- const QList<QScreen *> screenList = QGuiApplication::screens();
-
- // Re-build our screens list. This is the easiest way to later compute which signals to emit.
- // Create new screen widgets as necessary.
- // Furthermore, we note which screens have changed, and compute the overall virtual geometry.
- QFlatMap<QScreen*, QWidget*> newScreenWidgets;
- QRegion virtualGeometry;
-
- for (QScreen *screen : screenList) {
- const QRect screenGeometry = screen->geometry();
- QWidget *screenWidget = screenWidgets.value(screen);
- if (!screenWidget) {
- // a new screen, create a widget and connect the signals.
- screenWidget = new QWidget(nullptr, Qt::Desktop);
- screenWidget->setVisible(false);
- screenWidget->setScreen(screen);
- screenWidget->setGeometry(screenGeometry);
- screenWidget->setObjectName(QLatin1String("qt_desktop_widget_%1").arg(screen->name()));
- QObjectPrivate::connect(screen, &QScreen::geometryChanged,
- this, &QDesktopWidgetPrivate::updateScreens, Qt::QueuedConnection);
- QObjectPrivate::connect(screen, &QObject::destroyed,
- this, &QDesktopWidgetPrivate::updateScreens, Qt::QueuedConnection);
- }
- // record all the screens and the overall geometry.
- newScreenWidgets.insert(screen, screenWidget);
- virtualGeometry += screenGeometry;
- }
-
- // Now we apply the accumulated updates.
- qSwap(screenWidgets, newScreenWidgets); // now [newScreenWidgets] is the old screen list
- Q_ASSERT(screenWidgets.size() == screenList.length());
- q->setGeometry(virtualGeometry.boundingRect());
-
- // Delete the screen widgets that are not used any more.
- for (auto it : qAsConst(newScreenWidgets)) {
- if (!screenWidgets.contains(it.first))
- delete it.second;
- }
-}
-
-QDesktopWidget::QDesktopWidget()
- : QWidget(*new QDesktopWidgetPrivate, nullptr, Qt::Desktop)
-{
- Q_D(QDesktopWidget);
- setObjectName(QLatin1String("desktop"));
- d->updateScreens();
- QObjectPrivate::connect(qApp, &QApplication::screenAdded, d, &QDesktopWidgetPrivate::updateScreens);
-}
-
-QDesktopWidget::~QDesktopWidget() = default;
-
-/*!
- \internal
- Returns the Qt::Desktop type widget for \a qScreen.
-*/
-QWidget *QDesktopWidget::widgetForScreen(QScreen *qScreen) const
-{
- Q_D(const QDesktopWidget);
- return d->screenWidgets.value(qScreen);
-}
-
-
-QT_END_NAMESPACE
-
-#include "moc_qdesktopwidget_p.cpp"
diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h
deleted file mode 100644
index 5e8c256040..0000000000
--- a/src/widgets/kernel/qdesktopwidget_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QDESKTOPWIDGET_P_H
-#define QDESKTOPWIDGET_P_H
-
-#include <QtWidgets/private/qtwidgetsglobal_p.h>
-#include "private/qwidget_p.h"
-
-#include <QtGui/qscreen.h>
-#include <QtCore/private/qflatmap_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDesktopWidgetPrivate;
-
-class Q_WIDGETS_EXPORT QDesktopWidget : public QWidget
-{
- Q_OBJECT
-public:
- QDesktopWidget();
- ~QDesktopWidget();
-
- QWidget *widgetForScreen(QScreen *qScreen) const;
-
-private:
- Q_DISABLE_COPY(QDesktopWidget)
- Q_DECLARE_PRIVATE(QDesktopWidget)
-};
-
-class QDesktopWidgetPrivate : public QWidgetPrivate
-{
- Q_DECLARE_PUBLIC(QDesktopWidget)
-
-public:
- ~QDesktopWidgetPrivate();
- void updateScreens();
-
- QFlatMap<QScreen*, QWidget*> screenWidgets;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDESKTOPWIDGET_QPA_P_H