diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index d22883a61..aadfae72c 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -2692,7 +2692,7 @@ auto MainWindow::FullParsePattern() -> bool { if (VAbstractValApplication::VApp()->getOpeningPattern()) { - futureTestUniqueId = QtConcurrent::run(static_cast(doc), &VDomDocument::TestUniqueId); // clazy:exclude=unneeded-cast + futureTestUniqueId = QtConcurrent::run([this](){doc->TestUniqueId();}); } SetEnabledGUI(true); diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index b8e7e42bb..b2c83ba7e 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -1025,9 +1025,12 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai // TODO. Delete if minimal supported version is 0.4.0 Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 4, 0), "Time to refactor the code."); - const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1')); - const qreal width = GetParametrDouble(domElement, AttrWidth, QStringLiteral("0.0")); - futurePathV1 = QtConcurrent::run(this, &VPattern::ParseDetailNodes, element, width, closed); + futurePathV1 = QtConcurrent::run([this, domElement, element]() + { + const bool closed = GetParametrUInt(domElement, AttrClosed, QChar('1')); + const qreal width = GetParametrDouble(domElement, AttrWidth, QStringLiteral("0.0")); + return ParseDetailNodes(element, width, closed); + }); } else { @@ -1035,16 +1038,22 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai } break; case 1:// TagData - futurePPData = QtConcurrent::run(this, &VPattern::ParsePieceDataTag, element, - detail.GetPieceLabelData()); + futurePPData = QtConcurrent::run([this, element, detail]() + { + return ParsePieceDataTag(element, detail.GetPieceLabelData()); + }); break; case 2:// TagPatternInfo - futurePatternInfo = QtConcurrent::run(this, &VPattern::ParsePiecePatternInfo, element, - detail.GetPatternLabelData()); + futurePatternInfo = QtConcurrent::run([this, element, detail]() + { + return ParsePiecePatternInfo(element, detail.GetPatternLabelData()); + }); break; case 3:// TagGrainline - futureGGeometry = QtConcurrent::run(this, &VPattern::ParsePieceGrainline, element, - detail.GetGrainlineGeometry()); + futureGGeometry = QtConcurrent::run([this, element, detail]() + { + return ParsePieceGrainline(element, detail.GetGrainlineGeometry()); + }); break; case 4:// VToolSeamAllowance::TagCSA futureRecords = QtConcurrent::run(&VPattern::ParsePieceCSARecords, element); diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index dbc63e477..9b14c4be8 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -324,7 +324,7 @@ bool VAbstractPattern::RequiresMeasurements() const //--------------------------------------------------------------------------------------------------------------------- QStringList VAbstractPattern::ListMeasurements() const { - const QFuture futureIncrements = QtConcurrent::run(this, &VAbstractPattern::ListIncrements); + const QFuture futureIncrements = QtConcurrent::run([this](){return ListIncrements();}); const QList tokens = ConvertToList(QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens, GatherTokens)); @@ -1722,16 +1722,15 @@ QVector VAbstractPattern::ListExpressions() const // If new tool bring absolutely new type and has formula(s) create new method to cover it. // Note. Tool Union Details also contains formulas, but we don't use them for union and keep only to simplifying // working with nodes. Same code for saving reading. - auto futurePointExpressions = QtConcurrent::run(this, &VAbstractPattern::ListPointExpressions); - auto futureArcExpressions = QtConcurrent::run(this, &VAbstractPattern::ListArcExpressions); - auto futureElArcExpressions = QtConcurrent::run(this, &VAbstractPattern::ListElArcExpressions); - auto futureSplineExpressions = QtConcurrent::run(this, &VAbstractPattern::ListSplineExpressions); - auto futureIncrementExpressions = QtConcurrent::run(this, &VAbstractPattern::ListIncrementExpressions); - auto futureOperationExpressions = QtConcurrent::run(this, &VAbstractPattern::ListOperationExpressions); - auto futurePathExpressions = QtConcurrent::run(this, &VAbstractPattern::ListPathExpressions); - auto futurePieceExpressions = QtConcurrent::run(this, &VAbstractPattern::ListPieceExpressions); - auto futureFinalMeasurementsExpressions = QtConcurrent::run(this, - &VAbstractPattern::ListFinalMeasurementsExpressions); + auto futurePointExpressions = QtConcurrent::run([this](){return ListPointExpressions();}); + auto futureArcExpressions = QtConcurrent::run([this](){return ListArcExpressions();}); + auto futureElArcExpressions = QtConcurrent::run([this](){return ListElArcExpressions();}); + auto futureSplineExpressions = QtConcurrent::run([this](){return ListSplineExpressions();}); + auto futureIncrementExpressions = QtConcurrent::run([this](){return ListIncrementExpressions();}); + auto futureOperationExpressions = QtConcurrent::run([this](){return ListOperationExpressions();}); + auto futurePathExpressions = QtConcurrent::run([this](){return ListPathExpressions();}); + auto futurePieceExpressions = QtConcurrent::run([this](){return ListPieceExpressions();}); + auto futureFinalMeasurementsExpressions = QtConcurrent::run([this](){return ListFinalMeasurementsExpressions();}); QVector list; list << futurePointExpressions.result(); diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index 159445960..2b5fdbc04 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -703,7 +703,7 @@ void VDomDocument::RefreshElementIdCache() { if (m_watcher->isFinished()) { - m_watcher->setFuture(QtConcurrent::run(this, &VDomDocument::RefreshCache, documentElement())); + m_watcher->setFuture(QtConcurrent::run([this](){return RefreshCache(documentElement());})); } } diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 3ed224c3b..3e673b36d 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -622,10 +622,12 @@ VLayoutPiece::~VLayoutPiece() //NOLINT(modernize-use-equals-default) //--------------------------------------------------------------------------------------------------------------------- auto VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContainer *pattern) -> VLayoutPiece { - QFuture > futureSeamAllowance = QtConcurrent::run(piece, &VPiece::SeamAllowancePoints, - pattern); - QFuture futureSeamAllowanceValid = QtConcurrent::run(piece, &VPiece::IsSeamAllowanceValid, pattern); - QFuture > futureMainPath = QtConcurrent::run(piece, &VPiece::MainPathPoints, pattern); + QFuture > futureSeamAllowance = + QtConcurrent::run([piece, pattern](){return piece.SeamAllowancePoints(pattern);}); + QFuture futureSeamAllowanceValid = + QtConcurrent::run([piece, pattern](){return piece.IsSeamAllowanceValid(pattern);}); + QFuture > futureMainPath = + QtConcurrent::run([piece, pattern](){return piece.MainPathPoints(pattern);}); QFuture > futureInternalPaths = QtConcurrent::run(ConvertInternalPaths, piece, pattern); QFuture > futurePassmarks = QtConcurrent::run(ConvertPassmarks, piece, pattern); QFuture > futurePlaceLabels = QtConcurrent::run(ConvertPlaceLabels, piece, pattern); diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index fde121e23..39058a446 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1424,18 +1424,18 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren) this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false); const VPiece detail = VAbstractTool::data.GetPiece(m_id); - QFuture futurePath = QtConcurrent::run(detail, - QOverload::of(&VPiece::MainPathPath), - this->getData()); - QFuture futurePassmarks = QtConcurrent::run(detail, &VPiece::PassmarksPath, this->getData()); + + QFuture futurePath = QtConcurrent::run([this, detail](){return detail.MainPathPath(getData());}); + QFuture futurePassmarks = + QtConcurrent::run([this, detail](){return detail.PassmarksPath(getData());}); QFuture > futureSeamAllowance; QFuture futureSeamAllowanceValid; if (detail.IsSeamAllowance()) { - futureSeamAllowance = QtConcurrent::run(detail, &VPiece::SeamAllowancePoints, this->getData()); - futureSeamAllowanceValid = QtConcurrent::run(detail, &VPiece::IsSeamAllowanceValid, this->getData()); + futureSeamAllowance = QtConcurrent::run([this, detail](){return detail.SeamAllowancePoints(getData());}); + futureSeamAllowanceValid = QtConcurrent::run([this, detail](){return detail.IsSeamAllowanceValid(getData());}); } this->setPos(detail.GetMx(), detail.GetMy());