From: Scott Kostyshak Date: Sat, 7 Mar 2020 02:04:15 +0000 (-0500) Subject: Fix Qt deprecation warn for QList::fromSet() X-Git-Tag: lyx-2.4.0dev-acb2ca7b~1143 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=690c671b1d74aea566f7b4c952059afef2d4904a;p=features.git Fix Qt deprecation warn for QList::fromSet() Fix the following warning from Qt 5.14.1: error: ‘static QList QList::fromSet(const QSet&) [with T = QString]’ is deprecated: Use QList(set.begin(), set.end()) instead. [-Werror=deprecated-declarations] Regarding QList::fromSet(), the documentation now states the following [1]: Since Qt 5.14, range constructors are available for Qt's generic container classes and should be used in place of this method. [1] https://doc.qt.io/qt-5/qlist.html --- diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp index 0311b8b25f..f8cb247179 100644 --- a/src/frontends/qt/qt_helpers.cpp +++ b/src/frontends/qt/qt_helpers.cpp @@ -335,8 +335,12 @@ QStringList texFileList(QString const & filename) set.insert(qfile); } - // remove duplicates - return QList::fromSet(set); + // remove duplicates +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + return QList(set.begin(), set.end()); +#else + return QList::fromSet(set); +#endif } QString const externalLineEnding(docstring const & str)