Use QT_CHECK_VERSION to condition on qt version

This commit is contained in:
Jean-Marc Lasgouttes 2024-10-23 13:22:50 +02:00
parent c39d5b760c
commit 29c4e4706e
10 changed files with 27 additions and 27 deletions

View File

@ -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."); out << qt_("Please install correctly to estimate the great\namount of work other people have done for the LyX project.");
} else { } else {
QTextStream ts(&file); QTextStream ts(&file);
#if QT_VERSION < 0x060000 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec("UTF-8"); ts.setCodec("UTF-8");
#endif #endif
QString line; 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."); out << qt_("Please install correctly to see what has changed\nfor this version of LyX.");
} else { } else {
QTextStream ts(&file); QTextStream ts(&file);
#if QT_VERSION < 0x060000 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec("UTF-8"); ts.setCodec("UTF-8");
#endif #endif
QString line; QString line;

View File

@ -127,8 +127,8 @@
#endif #endif
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
# if (QT_VERSION >= 0x060000) # if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
# if (QT_VERSION >= 0x060500) # if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
# include <QtGui/QWindowsMimeConverter> # include <QtGui/QWindowsMimeConverter>
# define QWINDOWSMIME QWindowsMimeConverter # define QWINDOWSMIME QWindowsMimeConverter
# define QVARIANTTYPE QMetaType # define QVARIANTTYPE QMetaType
@ -152,7 +152,7 @@ using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
# include <objidl.h> # include <objidl.h>
#endif #endif
#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000) #if defined(Q_OS_MAC) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include <QMacPasteboardMime> #include <QMacPasteboardMime>
#endif // Q_OS_MAC #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. // QMacPasteboardMimeGraphics can only be compiled on Mac.
class QMacPasteboardMimeGraphics : public QMacPasteboardMime class QMacPasteboardMimeGraphics : public QMacPasteboardMime
@ -1009,7 +1009,7 @@ struct GuiApplication::Private
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
/// WMF Mime handler for Windows clipboard. /// WMF Mime handler for Windows clipboard.
wmf_mime_ = new QWindowsMimeMetafile; 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 *> win_app_ = dynamic_cast<QWindowsApplication *>
(QGuiApplicationPrivate::platformIntegration()); (QGuiApplicationPrivate::platformIntegration());
win_app_->registerMime(wmf_mime_); win_app_->registerMime(wmf_mime_);
@ -1018,7 +1018,7 @@ struct GuiApplication::Private
initKeySequences(&theTopLevelKeymap()); 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) #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
~Private() ~Private()
{ {
@ -1093,7 +1093,7 @@ struct GuiApplication::Private
/// Holds previous application state on Mac /// Holds previous application state on Mac
Qt::ApplicationState last_state_; 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. /// Linkback mime handler for MacOSX.
QMacPasteboardMimeGraphics mac_pasteboard_mime_; QMacPasteboardMimeGraphics mac_pasteboard_mime_;
#endif #endif
@ -1101,7 +1101,7 @@ struct GuiApplication::Private
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
/// WMF Mime handler for Windows clipboard. /// WMF Mime handler for Windows clipboard.
QWindowsMimeMetafile * wmf_mime_; 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_; QWindowsApplication * win_app_;
#endif #endif
#endif #endif
@ -1130,7 +1130,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
QCoreApplication::setOrganizationName(app_name); QCoreApplication::setOrganizationName(app_name);
QCoreApplication::setOrganizationDomain("lyx.org"); QCoreApplication::setOrganizationDomain("lyx.org");
QCoreApplication::setApplicationName(lyx_package); QCoreApplication::setApplicationName(lyx_package);
#if QT_VERSION < 0x060000 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif #endif
@ -2817,7 +2817,7 @@ void GuiApplication::execBatchCommands()
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); 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); setAttribute(Qt::AA_UseHighDpiPixmaps,true);
# endif # endif
// Create the global default menubar which is shown for the dialogs // Create the global default menubar which is shown for the dialogs

View File

@ -122,7 +122,7 @@ public:
bool notify(QObject * receiver, QEvent * event) override; bool notify(QObject * receiver, QEvent * event) override;
void commitData(QSessionManager & sm); void commitData(QSessionManager & sm);
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB) #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 #define QINTPTR long
#else #else
#define QINTPTR qintptr #define QINTPTR qintptr

View File

@ -361,7 +361,7 @@ QString tidyHtml(QString const & input)
// clutter. // clutter.
QTextDocument converter; QTextDocument converter;
converter.setHtml(input); converter.setHtml(input);
#if QT_VERSION < 0x060000 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return converter.toHtml("utf-8"); return converter.toHtml("utf-8");
#else #else
return converter.toHtml(); return converter.toHtml();

View File

@ -2896,7 +2896,7 @@ void GuiDocument::updateFontlist()
fontModule->fontsMathCO->addItem(qt_("Class Default (TeX Fonts)"), QString("auto")); fontModule->fontsMathCO->addItem(qt_("Class Default (TeX Fonts)"), QString("auto"));
fontModule->fontsMathCO->addItem(unimath, QString("default")); fontModule->fontsMathCO->addItem(unimath, QString("default"));
#if QT_VERSION >= 0x060000 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QStringList families(QFontDatabase::families()); const QStringList families(QFontDatabase::families());
#else #else
QFontDatabase fontdb; QFontDatabase fontdb;

View File

@ -56,7 +56,7 @@ GuiHSpace::GuiHSpace(bool math_mode, QWidget * parent)
spacingCO->addItem(qt_("Visible Space"), "visible"); spacingCO->addItem(qt_("Visible Space"), "visible");
spacingCO->addItem(qt_("Custom"), "custom"); spacingCO->addItem(qt_("Custom"), "custom");
#if QT_VERSION < 0x050e00 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(spacingCO, SIGNAL(highlighted(QString)), connect(spacingCO, SIGNAL(highlighted(QString)),
this, SLOT(changedSlot())); this, SLOT(changedSlot()));
#else #else

View File

@ -802,7 +802,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
{ {
setupUi(this); setupUi(this);
#if QT_VERSION < 0x050e00 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(screenRomanCO, SIGNAL(activated(QString)), connect(screenRomanCO, SIGNAL(activated(QString)),
this, SLOT(selectRoman(QString))); this, SLOT(selectRoman(QString)));
connect(screenSansCO, SIGNAL(activated(QString)), connect(screenSansCO, SIGNAL(activated(QString)),
@ -818,7 +818,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
this, SLOT(selectTypewriter(QString))); this, SLOT(selectTypewriter(QString)));
#endif #endif
#if QT_VERSION >= 0x060000 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QStringList families(QFontDatabase::families()); const QStringList families(QFontDatabase::families());
#else #else
QFontDatabase fontdb; QFontDatabase fontdb;
@ -829,7 +829,7 @@ PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
screenSansCO->addItem(family); screenSansCO->addItem(family);
screenTypewriterCO->addItem(family); screenTypewriterCO->addItem(family);
} }
#if QT_VERSION < 0x050e00 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(screenRomanCO, SIGNAL(activated(QString)), connect(screenRomanCO, SIGNAL(activated(QString)),
this, SIGNAL(changed())); this, SIGNAL(changed()));
connect(screenSansCO, SIGNAL(activated(QString)), connect(screenSansCO, SIGNAL(activated(QString)),
@ -1563,7 +1563,7 @@ PrefConverters::PrefConverters(GuiPreferences * form)
this, SLOT(updateConverter())); this, SLOT(updateConverter()));
connect(convertersLW, SIGNAL(currentRowChanged(int)), connect(convertersLW, SIGNAL(currentRowChanged(int)),
this, SLOT(switchConverter())); this, SLOT(switchConverter()));
#if QT_VERSION < 0x050e00 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(converterFromCO, SIGNAL(activated(QString)), connect(converterFromCO, SIGNAL(activated(QString)),
this, SLOT(changeConverter())); this, SLOT(changeConverter()));
connect(converterToCO, SIGNAL(activated(QString)), connect(converterToCO, SIGNAL(activated(QString)),
@ -1934,7 +1934,7 @@ PrefFileformats::PrefFileformats(GuiPreferences * form)
this, SLOT(updatePrettyname())); this, SLOT(updatePrettyname()));
connect(formatsCB->lineEdit(), SIGNAL(textEdited(QString)), connect(formatsCB->lineEdit(), SIGNAL(textEdited(QString)),
this, SIGNAL(changed())); this, SIGNAL(changed()));
#if QT_VERSION < 0x050e00 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(defaultFormatCB, SIGNAL(activated(QString)), connect(defaultFormatCB, SIGNAL(activated(QString)),
this, SIGNAL(changed())); this, SIGNAL(changed()));
connect(defaultOTFFormatCB, SIGNAL(activated(QString)), connect(defaultOTFFormatCB, SIGNAL(activated(QString)),

View File

@ -603,7 +603,7 @@ GuiSearch::GuiSearch(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags
void GuiSearch::mousePressEvent(QMouseEvent * event) void GuiSearch::mousePressEvent(QMouseEvent * event)
{ {
if (isFloating() && event->button() == Qt::LeftButton) { 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(); dragPosition = event->globalPosition().toPoint() - frameGeometry().topLeft();
#else #else
dragPosition = event->globalPos() - frameGeometry().topLeft(); dragPosition = event->globalPos() - frameGeometry().topLeft();
@ -617,7 +617,7 @@ void GuiSearch::mousePressEvent(QMouseEvent * event)
void GuiSearch::mouseMoveEvent(QMouseEvent * event) void GuiSearch::mouseMoveEvent(QMouseEvent * event)
{ {
if (isFloating() && event->buttons() & Qt::LeftButton) { if (isFloating() && event->buttons() & Qt::LeftButton) {
#if QT_VERSION >= 0x060000 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
move(event->globalPosition().toPoint() - dragPosition); move(event->globalPosition().toPoint() - dragPosition);
#else #else
move(event->globalPos() - dragPosition); move(event->globalPos() - dragPosition);

View File

@ -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) void TearOff::enterEvent(QEvent * event)
#else #else
void TearOff::enterEvent(QEnterEvent * event) void TearOff::enterEvent(QEnterEvent * event)
@ -81,7 +81,7 @@ void TearOff::paintEvent(QPaintEvent * /*event*/)
menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
menuOpt.menuRect = rect(); menuOpt.menuRect = rect();
menuOpt.maxIconWidth = 0; menuOpt.maxIconWidth = 0;
#if QT_VERSION < 0x060000 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
menuOpt.tabWidth = 0; menuOpt.tabWidth = 0;
#endif #endif
menuOpt.menuItemType = QStyleOptionMenuItem::TearOff; menuOpt.menuItemType = QStyleOptionMenuItem::TearOff;
@ -103,7 +103,7 @@ IconPalette::IconPalette(QWidget * parent)
v->setSpacing(0); v->setSpacing(0);
layout_ = new QGridLayout; layout_ = new QGridLayout;
layout_->setSpacing(0); 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); const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
layout_->setMargin(fw); layout_->setMargin(fw);
#else #else

View File

@ -27,7 +27,7 @@ class TearOff : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
TearOff(QWidget * parent); TearOff(QWidget * parent);
#if QT_VERSION < 0x060000 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEvent *) override; void enterEvent(QEvent *) override;
#else #else
void enterEvent(QEnterEvent *) override; void enterEvent(QEnterEvent *) override;