[LyX/master] Use QT_CHECK_VERSION to condition on qt version

Jean-Marc Lasgouttes lasgouttes at lyx.org
Wed Oct 23 11:23:22 UTC 2024


commit 29c4e4706e18a2346bd4135b1828ed8040b77c90
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Wed Oct 23 13:22:50 2024 +0200

    Use QT_CHECK_VERSION to condition on qt version
---
 src/frontends/qt/GuiAbout.cpp       |  4 ++--
 src/frontends/qt/GuiApplication.cpp | 20 ++++++++++----------
 src/frontends/qt/GuiApplication.h   |  2 +-
 src/frontends/qt/GuiClipboard.cpp   |  2 +-
 src/frontends/qt/GuiDocument.cpp    |  2 +-
 src/frontends/qt/GuiHSpace.cpp      |  2 +-
 src/frontends/qt/GuiPrefs.cpp       | 10 +++++-----
 src/frontends/qt/GuiSearch.cpp      |  4 ++--
 src/frontends/qt/IconPalette.cpp    |  6 +++---
 src/frontends/qt/IconPalette.h      |  2 +-
 10 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/frontends/qt/GuiAbout.cpp b/src/frontends/qt/GuiAbout.cpp
index a3614367de..0cfc86ba2d 100644
--- a/src/frontends/qt/GuiAbout.cpp
+++ b/src/frontends/qt/GuiAbout.cpp
@@ -59,7 +59,7 @@ static QString credits()
 			out << qt_("Please install correctly to estimate the great\namount of work other people have done for the LyX project.");
 		} else {
 			QTextStream ts(&file);
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 			ts.setCodec("UTF-8");
 #endif
 			QString line;
@@ -103,7 +103,7 @@ static QString release_notes()
 			out << qt_("Please install correctly to see what has changed\nfor this version of LyX.");
 		} else {
 			QTextStream ts(&file);
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 			ts.setCodec("UTF-8");
 #endif
 			QString line;
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 6863de7fc1..9cbcdbb386 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -127,8 +127,8 @@
 #endif
 
 #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
-#  if (QT_VERSION >= 0x060000)
-#    if (QT_VERSION >= 0x060500)
+#  if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
+#    if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
 #      include <QtGui/QWindowsMimeConverter>
 #      define QWINDOWSMIME QWindowsMimeConverter
 #      define QVARIANTTYPE QMetaType
@@ -152,7 +152,7 @@ using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
 #  include <objidl.h>
 #endif
 
-#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
+#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
 #include <QMacPasteboardMime>
 #endif // Q_OS_MAC
 
@@ -785,7 +785,7 @@ public:
 //
 ////////////////////////////////////////////////////////////////////////
 
-#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
+#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
 // QMacPasteboardMimeGraphics can only be compiled on Mac.
 
 class QMacPasteboardMimeGraphics : public QMacPasteboardMime
@@ -1009,7 +1009,7 @@ struct GuiApplication::Private
 	#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
 		/// WMF Mime handler for Windows clipboard.
 		wmf_mime_ = new QWindowsMimeMetafile;
-	#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
+	#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
 		win_app_ = dynamic_cast<QWindowsApplication *>
 			(QGuiApplicationPrivate::platformIntegration());
 		win_app_->registerMime(wmf_mime_);
@@ -1018,7 +1018,7 @@ struct GuiApplication::Private
 		initKeySequences(&theTopLevelKeymap());
 	}
 
-	#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
+	#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
 	#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
 	~Private()
 	{
@@ -1093,7 +1093,7 @@ struct GuiApplication::Private
 	/// Holds previous application state on Mac
 	Qt::ApplicationState last_state_;
 
-#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
+#if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
 	/// Linkback mime handler for MacOSX.
 	QMacPasteboardMimeGraphics mac_pasteboard_mime_;
 #endif
@@ -1101,7 +1101,7 @@ struct GuiApplication::Private
 #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
 	/// WMF Mime handler for Windows clipboard.
 	QWindowsMimeMetafile * wmf_mime_;
-#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
 	QWindowsApplication * win_app_;
 #endif
 #endif
@@ -1130,7 +1130,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
 	QCoreApplication::setOrganizationName(app_name);
 	QCoreApplication::setOrganizationDomain("lyx.org");
 	QCoreApplication::setApplicationName(lyx_package);
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 	QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
 #endif
 
@@ -2817,7 +2817,7 @@ void GuiApplication::execBatchCommands()
 
 #ifdef Q_OS_MAC
 	setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta);
-#  if QT_VERSION < 0x060000
+#  if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 	setAttribute(Qt::AA_UseHighDpiPixmaps,true);
 #  endif
 	// Create the global default menubar which is shown for the dialogs
diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h
index fa11a72b9e..0a4d75e329 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -122,7 +122,7 @@ public:
 	bool notify(QObject * receiver, QEvent * event) override;
 	void commitData(QSessionManager & sm);
 #if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
-#if (QT_VERSION < 0x060000)
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
 #define QINTPTR long
 #else
 #define QINTPTR qintptr
diff --git a/src/frontends/qt/GuiClipboard.cpp b/src/frontends/qt/GuiClipboard.cpp
index 60c8088f37..6303e40c65 100644
--- a/src/frontends/qt/GuiClipboard.cpp
+++ b/src/frontends/qt/GuiClipboard.cpp
@@ -361,7 +361,7 @@ QString tidyHtml(QString const & input)
 	// clutter.
 	QTextDocument converter;
 	converter.setHtml(input);
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 	return converter.toHtml("utf-8");
 #else
 	return converter.toHtml();
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 4c2c98cb5b..cf4cc1ca27 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -2896,7 +2896,7 @@ void GuiDocument::updateFontlist()
 		fontModule->fontsMathCO->addItem(qt_("Class Default (TeX Fonts)"), QString("auto"));
 		fontModule->fontsMathCO->addItem(unimath, QString("default"));
 
-#if QT_VERSION >= 0x060000
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
 		const QStringList families(QFontDatabase::families());
 #else
 		QFontDatabase fontdb;
diff --git a/src/frontends/qt/GuiHSpace.cpp b/src/frontends/qt/GuiHSpace.cpp
index bc2696dfc9..3f16500479 100644
--- a/src/frontends/qt/GuiHSpace.cpp
+++ b/src/frontends/qt/GuiHSpace.cpp
@@ -56,7 +56,7 @@ GuiHSpace::GuiHSpace(bool math_mode, QWidget * parent)
 		spacingCO->addItem(qt_("Visible Space"), "visible");
 	spacingCO->addItem(qt_("Custom"), "custom");
 
-#if QT_VERSION < 0x050e00
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
 	connect(spacingCO, SIGNAL(highlighted(QString)),
 		this, SLOT(changedSlot()));
 #else
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 6aba03373f..8a25e20451 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -802,7 +802,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
 {
 	setupUi(this);
 
-#if QT_VERSION < 0x050e00
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
 	connect(screenRomanCO, SIGNAL(activated(QString)),
 		this, SLOT(selectRoman(QString)));
 	connect(screenSansCO, SIGNAL(activated(QString)),
@@ -818,7 +818,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
 		this, SLOT(selectTypewriter(QString)));
 #endif
 
-#if QT_VERSION >= 0x060000
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
 	const QStringList families(QFontDatabase::families());
 #else
 	QFontDatabase fontdb;
@@ -829,7 +829,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
 		screenSansCO->addItem(family);
 		screenTypewriterCO->addItem(family);
 	}
-#if QT_VERSION < 0x050e00
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
 	connect(screenRomanCO, SIGNAL(activated(QString)),
 		this, SIGNAL(changed()));
 	connect(screenSansCO, SIGNAL(activated(QString)),
@@ -1563,7 +1563,7 @@ PrefConverters::PrefConverters(GuiPreferences * form)
 		this, SLOT(updateConverter()));
 	connect(convertersLW, SIGNAL(currentRowChanged(int)),
 		this, SLOT(switchConverter()));
-#if QT_VERSION < 0x050e00
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
 	connect(converterFromCO, SIGNAL(activated(QString)),
 		this, SLOT(changeConverter()));
 	connect(converterToCO, SIGNAL(activated(QString)),
@@ -1934,7 +1934,7 @@ PrefFileformats::PrefFileformats(GuiPreferences * form)
 		this, SLOT(updatePrettyname()));
 	connect(formatsCB->lineEdit(), SIGNAL(textEdited(QString)),
 		this, SIGNAL(changed()));
-#if QT_VERSION < 0x050e00
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
 	connect(defaultFormatCB, SIGNAL(activated(QString)),
 		this, SIGNAL(changed()));
 	connect(defaultOTFFormatCB, SIGNAL(activated(QString)),
diff --git a/src/frontends/qt/GuiSearch.cpp b/src/frontends/qt/GuiSearch.cpp
index c702287635..92297d07e4 100644
--- a/src/frontends/qt/GuiSearch.cpp
+++ b/src/frontends/qt/GuiSearch.cpp
@@ -603,7 +603,7 @@ GuiSearch::GuiSearch(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags
 void GuiSearch::mousePressEvent(QMouseEvent * event)
 {
 	if (isFloating() && event->button() == Qt::LeftButton) {
-#if QT_VERSION >= 0x060000
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
 		dragPosition = event->globalPosition().toPoint() - frameGeometry().topLeft();
 #else
 		dragPosition = event->globalPos() - frameGeometry().topLeft();
@@ -617,7 +617,7 @@ void GuiSearch::mousePressEvent(QMouseEvent * event)
 void GuiSearch::mouseMoveEvent(QMouseEvent * event)
 {
 	if (isFloating() && event->buttons() & Qt::LeftButton) {
-#if QT_VERSION >= 0x060000
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
 		move(event->globalPosition().toPoint() - dragPosition);
 #else
 		move(event->globalPos() - dragPosition);
diff --git a/src/frontends/qt/IconPalette.cpp b/src/frontends/qt/IconPalette.cpp
index 7a5b1f3333..4c36a50f72 100644
--- a/src/frontends/qt/IconPalette.cpp
+++ b/src/frontends/qt/IconPalette.cpp
@@ -50,7 +50,7 @@ void TearOff::mouseReleaseEvent(QMouseEvent * /*event*/)
 }
 
 
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 void TearOff::enterEvent(QEvent * event)
 #else
 void TearOff::enterEvent(QEnterEvent * event)
@@ -81,7 +81,7 @@ void TearOff::paintEvent(QPaintEvent * /*event*/)
 	menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
 	menuOpt.menuRect = rect();
 	menuOpt.maxIconWidth = 0;
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 	menuOpt.tabWidth = 0;
 #endif
 	menuOpt.menuItemType = QStyleOptionMenuItem::TearOff;
@@ -103,7 +103,7 @@ IconPalette::IconPalette(QWidget * parent)
 	v->setSpacing(0);
 	layout_ = new QGridLayout;
 	layout_->setSpacing(0);
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 	const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
 	layout_->setMargin(fw);
 #else
diff --git a/src/frontends/qt/IconPalette.h b/src/frontends/qt/IconPalette.h
index e9f810181c..abd8e231c6 100644
--- a/src/frontends/qt/IconPalette.h
+++ b/src/frontends/qt/IconPalette.h
@@ -27,7 +27,7 @@ class TearOff : public QWidget {
 	Q_OBJECT
 public:
 	TearOff(QWidget * parent);
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
 	void enterEvent(QEvent *) override;
 #else
 	void enterEvent(QEnterEvent *) override;


More information about the lyx-cvs mailing list