From 1abff6b62c8ce8568471728506afea41dca27767 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 6 Jan 2020 20:10:09 +0200 Subject: [PATCH] Fix deprecation warnings. --HG-- branch : release --- src/app/tape/tmainwindow.cpp | 10 ++++++++++ src/app/valentina/mainwindowsnogui.cpp | 12 ++++++++++++ src/libs/ifc/xml/vabstractpattern.cpp | 16 +++++++++++++++- src/libs/vlayout/vlayoutgenerator.cpp | 4 ++++ src/libs/vlayout/vlayoutpiece.cpp | 4 ++++ src/libs/vpatterndb/vcontainer.cpp | 8 ++++++-- src/libs/vpatterndb/vpiece.cpp | 2 +- src/libs/vpatterndb/vpiecepath.cpp | 2 +- src/libs/vtools/undocommands/savetooloptions.cpp | 5 +++++ 9 files changed, 58 insertions(+), 5 deletions(-) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 3b4120893..474ab4d39 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -2824,8 +2824,13 @@ void TMainWindow::WriteSettings() //--------------------------------------------------------------------------------------------------------------------- QStringList TMainWindow::FilterMeasurements(const QStringList &mNew, const QStringList &mFilter) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + const auto import = QSet(mNew.begin(), mNew.end()).subtract(QSet(mFilter.begin(), mFilter.end())); + return QStringList(import.begin(), import.end()); +#else const QSet import = mNew.toSet().subtract(mFilter.toSet()); return QStringList(import.toList()); +#endif } //--------------------------------------------------------------------------------------------------------------------- @@ -3123,7 +3128,12 @@ QString TMainWindow::CheckMName(const QString &name, const QSet &import } else { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + const QStringList allGroupNames = AllGroupNames(); + if (not QSet(allGroupNames.begin(), allGroupNames.end()).contains(name)) +#else if (not AllGroupNames().toSet().contains(name)) +#endif { throw VException(tr("Measurement '%1' is not one of known measurements.").arg(name)); } diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 7fcb2bbd0..a60bb408b 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -1843,10 +1843,22 @@ QSharedPointer MainWindowsNoGUI::OpenMeasurementFile(const QStrin //--------------------------------------------------------------------------------------------------------------------- void MainWindowsNoGUI::CheckRequiredMeasurements(const VMeasurements *m) const { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QStringList patternMeasurments = doc->ListMeasurements(); + QStringList bodyMeasurments = m->ListAll(); + const auto match = QSet(patternMeasurments.begin(), patternMeasurments.end()) + .subtract(QSet(bodyMeasurments.begin(), bodyMeasurments.end())); +#else const QSet match = doc->ListMeasurements().toSet().subtract(m->ListAll().toSet()); +#endif + if (not match.isEmpty()) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QList list = QList(match.begin(), match.end()); +#else QList list = match.toList(); +#endif for (int i = 0; i < list.size(); ++i) { list[i] = qApp->TrVars()->MToUser(list.at(i)); diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 722313bc4..419fa2ce3 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -243,7 +243,11 @@ QList GetTokens(const VFormulaField &formula) //--------------------------------------------------------------------------------------------------------------------- void GatherTokens(QSet &tokens, const QList &tokenList) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + tokens = tokens.unite(QSet(tokenList.begin(), tokenList.end())); +#else tokens = tokens.unite(tokenList.toSet()); +#endif } //--------------------------------------------------------------------------------------------------------------------- @@ -294,11 +298,21 @@ QStringList VAbstractPattern::ListMeasurements() const { const QFuture futureIncrements = QtConcurrent::run(this, &VAbstractPattern::ListIncrements); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QSet results = QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens, GatherTokens); + const auto tokens = QList(results.begin(), results.end()); +#else const QList tokens = QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens, GatherTokens).toList(); +#endif QSet measurements; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QStringList result = futureIncrements.result(); + QSet others = QSet(result.begin(), result.end()); +#else QSet others = futureIncrements.result().toSet(); +#endif for (const auto &token : tokens) { @@ -310,7 +324,7 @@ QStringList VAbstractPattern::ListMeasurements() const IsVariable(token) || IsFunction(token) ? others.insert(token) : measurements.insert(token); } - return QStringList(measurements.toList()); + return QStringList(measurements.values()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vlayout/vlayoutgenerator.cpp b/src/libs/vlayout/vlayoutgenerator.cpp index 192f4cd88..6d2a4ac25 100644 --- a/src/libs/vlayout/vlayoutgenerator.cpp +++ b/src/libs/vlayout/vlayoutgenerator.cpp @@ -454,7 +454,11 @@ QList VLayoutGenerator::MoveDetails(qreal length, const QVector= QT_VERSION_CHECK(5, 14, 0) + return QList(details.begin(), details.end()); +#else return details.toList(); +#endif } QList newDetails; diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 3e6e4a32b..6c400d478 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -474,7 +474,11 @@ QVector VLayoutPiece::Map(const QVector &points) const if (d->mirror) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + auto list = QList(p.begin(), p.end()); +#else QList list = p.toList(); +#endif for (int k=0, s=list.size(), max=(s/2); k list = uniqueNames.value(d->nspace).toList(); + const QList list = uniqueNames.value(d->nspace).values(); ClearUniqueNames(); for(auto &name : list) @@ -823,7 +823,11 @@ const QHash > *VContainer::DataVariab //--------------------------------------------------------------------------------------------------------------------- VContainerData::~VContainerData() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + if (ref.loadRelaxed() == 0) +#else if (ref.load() == 0) +#endif { --VContainer::copyCounter[nspace]; } diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 8faa42af9..4ccce76b9 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -60,7 +60,7 @@ QVector PieceMissingNodes(const QVector &d1Nodes, const QVecto set2.insert(d2Nodes.at(j)); } - const QList set3 = set1.subtract(set2).toList(); + const QList set3 = set1.subtract(set2).values(); QVector r; for (qint32 i = 0; i < set3.size(); ++i) { diff --git a/src/libs/vpatterndb/vpiecepath.cpp b/src/libs/vpatterndb/vpiecepath.cpp index 11c7faf3c..7c6ec8624 100644 --- a/src/libs/vpatterndb/vpiecepath.cpp +++ b/src/libs/vpatterndb/vpiecepath.cpp @@ -660,7 +660,7 @@ QVector VPiecePath::MissingNodes(const VPiecePath &path) const set2.insert(path.at(j).GetId()); } - const QList set3 = set1.subtract(set2).toList(); + const QList set3 = set1.subtract(set2).values(); QVector nodes; nodes.reserve(set3.size()); for (qint32 i = 0; i < set3.size(); ++i) diff --git a/src/libs/vtools/undocommands/savetooloptions.cpp b/src/libs/vtools/undocommands/savetooloptions.cpp index 36a9b7bb1..3b7e11046 100644 --- a/src/libs/vtools/undocommands/savetooloptions.cpp +++ b/src/libs/vtools/undocommands/savetooloptions.cpp @@ -96,7 +96,12 @@ QVector SaveToolOptions::Missing(const QList &list1, const QLi { QSet set1 = QSet::fromList(list1); QSet set2 = QSet::fromList(list2); +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QSet substracted = set1.subtract(set2); + return QVector(substracted.begin(), substracted.end()); +#else return set1.subtract(set2).toList().toVector(); +#endif } //---------------------------------------------------------------------------------------------------------------------