[LyX/master] Require at least Qt 5.12

Jean-Marc Lasgouttes lasgouttes at lyx.org
Wed Oct 23 09:14:58 UTC 2024


commit 6ba2b5c5b9010dfe9b20b4e2d9abd6609e9b1301
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Wed Oct 23 10:48:45 2024 +0200

    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.
---
 INSTALL                                 |  8 ++++----
 README                                  |  4 ++--
 configure.ac                            |  2 +-
 src/convert/lyxconvert.cpp              |  7 -------
 src/insets/InsetInfo.cpp                | 24 ------------------------
 src/support/ConsoleApplicationPrivate.h |  6 ------
 src/support/FileName.cpp                |  5 -----
 src/support/Systemcall.cpp              |  4 ----
 src/support/lyxtime.cpp                 | 12 ------------
 9 files changed, 7 insertions(+), 65 deletions(-)

diff --git a/INSTALL b/INSTALL
index b7dc910753..b5afc79a6f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -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
diff --git a/README b/README
index fabdbac136..93b56c79f0 100644
--- a/README
+++ b/README
@@ -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.
 
diff --git a/configure.ac b/configure.ac
index c796b60f9d..cfe65299df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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\
diff --git a/src/convert/lyxconvert.cpp b/src/convert/lyxconvert.cpp
index 52ad54bdad..34063c19cc 100644
--- a/src/convert/lyxconvert.cpp
+++ b/src/convert/lyxconvert.cpp
@@ -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;
diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index 7ed5662b10..239f8278c4 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -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();
diff --git a/src/support/ConsoleApplicationPrivate.h b/src/support/ConsoleApplicationPrivate.h
index 347f9ad62f..affca2439c 100644
--- a/src/support/ConsoleApplicationPrivate.h
+++ b/src/support/ConsoleApplicationPrivate.h
@@ -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()
 	{
diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp
index 864f38770c..ee208cdf15 100644
--- a/src/support/FileName.cpp
+++ b/src/support/FileName.cpp
@@ -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
-	
 }
 
 
diff --git a/src/support/Systemcall.cpp b/src/support/Systemcall.cpp
index 7c4eaabc97..6878a3a0fb 100644
--- a/src/support/Systemcall.cpp
+++ b/src/support/Systemcall.cpp
@@ -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)));
 }
diff --git a/src/support/lyxtime.cpp b/src/support/lyxtime.cpp
index 99a797254c..f36c86b54d 100644
--- a/src/support/lyxtime.cpp
+++ b/src/support/lyxtime.cpp
@@ -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


More information about the lyx-cvs mailing list