[LyX/master] QDesktopWidget is not required in Qt5, the Qt6 code works

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sun Mar 5 19:51:36 UTC 2023


commit e2e1fd6ea9347a27cac86886d47682dbb901d083
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sun Mar 5 21:54:08 2023 +0100

    QDesktopWidget is not required in Qt5, the Qt6 code works
---
 src/frontends/qt/GuiApplication.cpp |    7 -------
 src/frontends/qt/IconPalette.cpp    |   10 +---------
 2 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 5750df9..f8a3e76 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -89,9 +89,6 @@
 #include <QByteArray>
 #include <QBitmap>
 #include <QDateTime>
-#if QT_VERSION < 0x060000
-#include <QDesktopWidget>
-#endif
 #include <QEvent>
 #include <QFileOpenEvent>
 #include <QFileInfo>
@@ -2638,11 +2635,7 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow,
 		// Negative displacements must be interpreted as distances
 		// from the right or bottom screen borders.
 		if (sx == '-' || sy == '-') {
-#if QT_VERSION < 0x060000
-			QRect rec = QApplication::desktop()->screenGeometry();
-#else
 			QRect rec = QGuiApplication::primaryScreen()->geometry();
-#endif
 			if (sx == '-')
 				x += rec.width() - w - framewidth;
 			if (sy == '-')
diff --git a/src/frontends/qt/IconPalette.cpp b/src/frontends/qt/IconPalette.cpp
index a3ed7b2..7a5b1f3 100644
--- a/src/frontends/qt/IconPalette.cpp
+++ b/src/frontends/qt/IconPalette.cpp
@@ -19,17 +19,13 @@
 #include <QToolTip>
 #include <QToolBar>
 #include <QApplication>
-#if QT_VERSION < 0x060000
-#include <QDesktopWidget>
-#endif
 #include <QPainter>
+#include <QScreen>
 #include <QStyle>
 #include <QStyleOptionFrame>
 #include <QMouseEvent>
 #include <QVBoxLayout>
-#if QT_VERSION >= 0x060000
 #include <QWindow>
-#endif
 
 namespace lyx {
 namespace frontend {
@@ -181,11 +177,7 @@ void IconPalette::showEvent(QShowEvent * /*event*/)
 		voffset -= parheight;
 	}
 
-#if QT_VERSION < 0x060000
-	QRect const screen = qApp->desktop()->availableGeometry(this);
-#else
 	QRect const screen = window()->windowHandle()->screen()->availableGeometry();
-#endif
 	QPoint const gpos = parentWidget()->mapToGlobal(
 		parentWidget()->geometry().bottomLeft());
 


More information about the lyx-cvs mailing list