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.");
} 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;

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -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

View File

@ -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)),

View File

@ -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);

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)
#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

View File

@ -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;