From 690c671b1d74aea566f7b4c952059afef2d4904a Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Fri, 6 Mar 2020 21:04:15 -0500 Subject: [PATCH] Fix Qt deprecation warn for QList::fromSet() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/frontends/qt/qt_helpers.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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) -- 2.39.2