diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-05-16 20:43:34 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-06-08 20:29:49 +0200 |
commit | 44fb925f50471ebc23dcccfaa4e9d9873b05d205 (patch) | |
tree | e4e212052b66242ff94aa98f6df7b15dbeb945f7 /src/widgets/dialogs | |
parent | a061a646429c6e9d695458fc0ecb0021a30e12ee (diff) |
Phase 2 of removing QDesktopWidget
Remove QDestopWidget public header, simplify the implementation that
maintains a Qt::Desktop type QWidget for each QScreen, and turn
QWidget's initial target screen into a QScreen pointer.
QApplication::desktop() now takes an optional QScreen pointer, and
returns a QWidget pointer, so that applications and widgets can get
access to the root widget for a specific screen without having to
resort to private APIs.
QDesktopWidgetPrivate implementations to look up a screen for an index,
widget, or point are now all inline functions that thinly wrap
QGuiApplication::screens/screenAt calls. We should consider adding those
as convenience APIs to QScreen instead.
Note that QWidget::screen is assumed to return a valid pointer; there is
code that handles the case that it returns nullptr (but also code that
trusts that it never is nullptr), so this needs to be defined, verified
with tests, and asserted. We can then simplify the code further.
Change-Id: Ifc89be65a0dce265b6729feaf54121c35137cb94
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 3 | ||||
-rw-r--r-- | src/widgets/dialogs/qdialog.cpp | 1 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 1 | ||||
-rw-r--r-- | src/widgets/dialogs/qwizard.cpp | 1 | ||||
-rw-r--r-- | src/widgets/dialogs/qwizard_win.cpp | 1 |
5 files changed, 1 insertions, 6 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index a605c35b05..8e5895f48b 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -40,7 +40,6 @@ #include "qcolordialog.h" #include "qapplication.h" -#include "qdesktopwidget.h" #include <private/qdesktopwidget_p.h> #include "qdrawutil.h" #include "qevent.h" @@ -1565,7 +1564,7 @@ bool QColorDialogPrivate::selectColor(const QColor &col) QColor QColorDialogPrivate::grabScreenColor(const QPoint &p) { - const QDesktopWidget *desktop = QApplication::desktop(); + const QWidget *desktop = QApplication::desktop(); const QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(desktop->winId(), p.x(), p.y(), 1, 1); QImage i = pixmap.toImage(); return i.pixel(0, 0); diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 14cfe6800c..0f0e213e71 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -49,7 +49,6 @@ #endif #include "qevent.h" -#include "qdesktopwidget.h" #include <private/qdesktopwidget_p.h> #include "qapplication.h" #include "qlayout.h" diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index c65d91cf9e..e0edc2f755 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -47,7 +47,6 @@ #include <QtWidgets/qstyle.h> #include <QtWidgets/qstyleoption.h> #include <QtWidgets/qgridlayout.h> -#include <QtWidgets/qdesktopwidget.h> #include <QtWidgets/qpushbutton.h> #include <QtWidgets/qcheckbox.h> #include <QtGui/qaccessible.h> diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index c7aac8b9da..ff2f202bb4 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -47,7 +47,6 @@ #include "qapplication.h" #include "qboxlayout.h" #include "qlayoutitem.h" -#include "qdesktopwidget.h" #include <private/qdesktopwidget_p.h> #include "qevent.h" #include "qframe.h" diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index e87d117a3c..1ec8fe8d91 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -52,7 +52,6 @@ #include <QtCore/QDebug> #include <QtGui/QMouseEvent> #include <QtGui/QWindow> -#include <QtWidgets/QDesktopWidget> #include <uxtheme.h> #include <vssym32.h> |