Require at least Qt 5.12

Update the #if confitional accordingly everywhere excpt in frontends/qt.

Update INSTALL and README.

Cmake will need to be updated too.
This commit is contained in:
Jean-Marc Lasgouttes 2024-10-23 10:48:45 +02:00
parent 3f6eb9523d
commit 6ba2b5c5b9
9 changed files with 7 additions and 65 deletions

View File

@ -59,10 +59,10 @@ LyX makes great use of the C++ Standard Library. This means that gcc
users will have to install the relevant libstdc++ library to be able
to compile this version of LyX.
For full LyX usability we suggest to use Qt 5.6 and higher, or at the
very least Qt 5.4. It is also possible to compile against Qt 6. The
only special point to make is that you must ensure that both LyX and
the Qt libraries are compiled with the same C++ compiler.
LyX requires Qt 5.12 and higher. It is also possible to compile
against Qt 6. The only special point to make is that you must ensure
that both LyX and the Qt libraries are compiled with the same C++
compiler.
To build LyX with spell checking capabilities included you have to
install at least one of the development packages of the spell checker

4
README
View File

@ -90,8 +90,8 @@ What do I need to compile LyX from the source distribution?
but clang and MSVC are known to work too. As of LyX 2.5.0, you
need at least gcc 8.0.
* The Qt library, at least version 5.2 (5.6 recommended). It is
also possible to compile with Qt 6.x.
* The Qt library, at least version 5.12. It is also possible to
compile with Qt 6.x.
Read the file "INSTALL" for more information on compiling.

View File

@ -147,7 +147,7 @@ AC_CHECK_HEADERS(magic.h,
### setup the qt frontend.
dnl The code below is not in a macro, because this would cause big
dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
QT_DO_IT_ALL([5.0.0])
QT_DO_IT_ALL([5.12.0])
AC_SUBST([FRONTENDS_SUBDIRS], [qt])
FRONTEND_INFO="${FRONTEND_INFO}\
Qt Frontend:\n\

View File

@ -28,9 +28,7 @@
#include <QImage>
#include <QFile>
#include <QPainter>
#if (QT_VERSION >= 0x050300)
#include <QPdfWriter>
#endif
const char * basename(const char * name)
@ -143,7 +141,6 @@ int main(int argc, char **argv)
std::cerr << myname << ": Conversion of images to format '" << oformat << "' is not supported" << std::endl;
return 4;
} else if (NULL != oformat && !strcmp(oformat, "pdf")) {
#if (QT_VERSION >= 0x050300)
QSize size = img.size();
QPdfWriter pdfwriter(QString::fromLocal8Bit(outfile));
int dpi = pdfwriter.logicalDpiX();
@ -154,10 +151,6 @@ int main(int argc, char **argv)
QPainter painter(&pdfwriter);
painter.drawImage(0, 0, img);
painter.end();
#else
std::cerr << myname << ": Conversion of images to format '" << oformat << "' is not supported" << std::endl;
return 4;
#endif
} else if (!img.save(QString::fromLocal8Bit(outfile), oformat)) {
std::cerr << myname << ": Cannot save converted image to '" << outfile << "'" << std::endl;
return 5;

View File

@ -303,11 +303,7 @@ vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
string const dt = split(name, '@');
QDate date;
if (itype == "moddate")
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
date = QDateTime::fromSecsSinceEpoch(buf->fileName().lastModified()).date();
#else
date = QDateTime::fromTime_t(buf->fileName().lastModified()).date();
#endif
else if (itype == "fixdate" && !dt.empty()) {
QDate const gdate = QDate::fromString(toqstr(dt), Qt::ISODate);
date = (gdate.isValid()) ? gdate : QDate::currentDate();
@ -334,11 +330,7 @@ vector<pair<string,docstring>> InsetInfoParams::getArguments(Buffer const * buf,
string const tt = split(name, '@');
QTime time;
if (itype == "modtime")
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
time = QDateTime::fromSecsSinceEpoch(buf->fileName().lastModified()).time();
#else
time = QDateTime::fromTime_t(buf->fileName().lastModified()).time();
#endif
else if (itype == "fixtime" && !tt.empty()) {
QTime const gtime = QTime::fromString(toqstr(tt), Qt::ISODate);
time = (gtime.isValid()) ? gtime : QTime::currentTime();
@ -1230,11 +1222,7 @@ void InsetInfo::build()
? split(params_.name, date_format, '@') : string();
QDate date;
if (params_.type == InsetInfoParams::MODDATE_INFO)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
date = QDateTime::fromSecsSinceEpoch(buffer().fileName().lastModified()).date();
#else
date = QDateTime::fromTime_t(buffer().fileName().lastModified()).date();
#endif
else if (params_.type == InsetInfoParams::FIXDATE_INFO && !date_specifier.empty())
date = QDate::fromString(toqstr(date_specifier), Qt::ISODate);
else
@ -1252,11 +1240,7 @@ void InsetInfo::build()
? split(params_.name, time_format, '@') : string();
QTime time;
if (params_.type == InsetInfoParams::MODTIME_INFO)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
time = QDateTime::fromSecsSinceEpoch(buffer().fileName().lastModified()).time();
#else
time = QDateTime::fromTime_t(buffer().fileName().lastModified()).time();
#endif
else if (params_.type == InsetInfoParams::FIXTIME_INFO && !time_specifier.empty())
time = QTime::fromString(toqstr(time_specifier), Qt::ISODate);
else
@ -1303,11 +1287,7 @@ std::pair<QDate, std::string> parseDate(Buffer const & buffer, const InsetInfoPa
QDate date;
if (params.type == InsetInfoParams::MODDATE_INFO)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
date = QDateTime::fromSecsSinceEpoch(buffer.fileName().lastModified()).date();
#else
date = QDateTime::fromTime_t(buffer.fileName().lastModified()).date();
#endif
else if (params.type == InsetInfoParams::FIXDATE_INFO && !date_specifier.empty()) {
QDate date = QDate::fromString(toqstr(date_specifier), Qt::ISODate);
date = (date.isValid()) ? date : QDate::currentDate();
@ -1328,11 +1308,7 @@ std::pair<QTime, std::string> parseTime(Buffer const & buffer, const InsetInfoPa
QTime time;
if (params.type == InsetInfoParams::MODTIME_INFO)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
time = QDateTime::fromSecsSinceEpoch(buffer.fileName().lastModified()).time();
#else
time = QDateTime::fromTime_t(buffer.fileName().lastModified()).time();
#endif
else if (params.type == InsetInfoParams::FIXTIME_INFO && !date_specifier.empty()) {
time = QTime::fromString(toqstr(date_specifier), Qt::ISODate);
time = (time.isValid()) ? time : QTime::currentTime();

View File

@ -16,9 +16,7 @@
#include <QCoreApplication>
#include <QDateTime>
#include <QTimer>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
#include <QRandomGenerator>
#endif
#include <string>
@ -41,11 +39,7 @@ public:
setOrganizationDomain("lyx.org");
setApplicationName(toqstr(app));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
#else
qsrand(QDateTime::currentDateTime().toTime_t());
#endif
}
int execute()
{

View File

@ -518,12 +518,7 @@ time_t FileName::lastModified() const
// been touched between the object creation and now, we refresh the file
// information.
d->refresh();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
return d->fi.lastModified().toSecsSinceEpoch();
#else
return d->fi.lastModified().toTime_t();
#endif
}

View File

@ -369,11 +369,7 @@ SystemcallPrivate::SystemcallPrivate(std::string const & sf, std::string const &
connect(process_, SIGNAL(readyReadStandardOutput()), SLOT(stdOut()));
connect(process_, SIGNAL(readyReadStandardError()), SLOT(stdErr()));
#if QT_VERSION >= 0x050600
connect(process_, SIGNAL(errorOccurred(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
#else
connect(process_, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
#endif
connect(process_, SIGNAL(started()), this, SLOT(processStarted()));
connect(process_, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));
}

View File

@ -37,20 +37,12 @@ time_t current_time()
docstring formatted_datetime(time_t t, string const & fmt)
{
QString qres;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
if (fmt.empty())
qres = QLocale().toString(QDateTime::fromSecsSinceEpoch(t),
QLocale::ShortFormat);
else
qres = QLocale().toString(QDateTime::fromSecsSinceEpoch(t),
toqstr(fmt));
#else
if (fmt.empty())
qres = QLocale().toString(QDateTime::fromTime_t(t),
QLocale::ShortFormat);
else
qres = QLocale().toString(QDateTime::fromTime_t(t), toqstr(fmt));
#endif
return qstring_to_ucs4(qres);
}
@ -77,11 +69,7 @@ time_t from_asctime_utc(string t)
#else
loc_dt.setTimeSpec(Qt::UTC);
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
return loc_dt.toSecsSinceEpoch();
#else
return loc_dt.toTime_t();
#endif
}
} // namespace support